Data block changing workers

These objects work on an entire data block (which includes not only a data element, eg. a wiki page, but also the type of the data element and possibly a "key" that distinguishes the element in some way).

All data block workers are situated in the subdirectory block.

Class name

Task

Creation params

Public properties

Notes

Worker_DataBlock_Copy

Copies a data block

Apibot core, New block key (optional at creation, but must be set at processing)

$new_key

If a block with the new key already exists, it will be overwritten

Worker_DataBlock_Rename

Renames a data block

Apibot core, New block key (optional at creation, but must be set at processing)

$new_key

If a block with the new key already exists, it will be overwritten

Worker_DataBlock_Set

Sets a data block to the line object default data key

Apibot core

If a block with the default data key already exists, it will be overwritten

Worker_DataBlock_Swap

Swaps a data block with another one

Apibot core, Other block key (optional at creation, but must be set at processing)

$key2

If one of the data blocks does not exist, the other will be effectively renamed

Worker_DataBlock_Unset

Unsets the data block with the line object default data key

Apibot core

Data type changing workers

These objects work on the data element type.

The types of the data elements are MIME-like strings: a data format, separated by a slash from the data type marker. For example: "array/page", "object/user", "numeric/pageid", "string/user" etc.

All data type workers are situated in the subdirectory type.

Class name

Task

Creation params

Public properties

Notes

Worker_DataType_Set

Sets a given data element type to the line object default data key

Apibot core, New data type (optional at creation, but must be set at processing)

$new_type

Data element changing workers

These workers process the data element.

All data type workers are situated in the subdirectory element.

All have the following public properties:

$new_element_type - the new type of the changed data element. If unset, the data type of the element will not be changed.

$sublevels - allows changing not the entire data element, but its subelement. Assign to it the name of the sublevel, or an array with the names of the consecutive sublevels. Only arrays and objects can have subelements (members and properties respectively).

Some examples for the second property:

The data element is a page, and you want to change its timestamp - set $sublevels to "timestamp", or to array ( "timestamp" ).

The data element is array, which has under the key "object5" an object, which has a property $users. To this property is assigned an array, which has under key "2" some value that you want to replace. In this case, set $sublevels to array ( "object5", "users", "2" ).

The data element is an object whose property $people is not set. What happens if you set $sublevels to array ( "people", "John", "birthdate" ) to some date? In this case, the missing levels will be created automatically as arrays. That is, to $people will be assigned an array, then to its key "John" will be assigned another array, and then to its key "birthdate" will be assigned the date you supply.

From data

These workers set the data element from data of the same or another element / block in the signal. Most of them can also change the data in some way.

All workers are situated in the subdirectory element/set/from_data.

All have the following public properties:

$from_data_key - the data key of the block and element data must be taken from. If left unset, the default data key is used.

$from_sublevels - allows taking not the entire data element, but its subelement. See the explanation for the $sublevel property above for details.

There are several categories of workers that set data from data:

Common

Class name

Task

Creation params

Public properties

Notes

Worker_DataElement_CopyData

Copies a given data (sub)element to the default data element (or its subelement), without changing it

Apibot core

Worker_DataElement_MoveData

Moves a given data (sub)element to the default data element (or its subelement), without changing it

Apibot core

Worker_DataElement_FromValue

Sets a given value to the default data element (or its subelement)

Apibot core, Value to be set (optional, but must be set at processing)

$value

Worker_DataElement_Counter

Sets a counter to the default data element (or its subelement)

Apibot core

$start (start value),

$end (reset to start value after passing this),$step (increase counter by this),$repeat (repeat every value so many times),$skip (skip so many signals after a value),$skip_before (skip so many signals before counting start)

Checksums

These create different checksums of the source data element (or subelement).

All need string type of data. If they get a wrong kind of data, that will stop the processing of the data element.

Class name

Task

Creation params

Public properties

Notes

Worker_DataElement_CRC32

Produces a CRC32 checksum of the data element (must be string).

Apibot core

Worker_DataElement_MD5

Produces an MD5 checksum of the data element (must be string).

Apibot core

Worker_DataElement_SHA1

Produces a SHA1 checksum of the data element (must be string).

Apibot core

Coders

These encode or decode the source data element (or subelement) in various ways.

Some of them might need a specific type of data. If they get a wrong kind of data, that will stop the processing of the data element.

Class name

Task

Creation params

Public properties

Notes

Worker_DataElement_Serialize

Produces a PHP serialized form of the data element.

Apibot core

Worker_DataElement_Unserialize

Unserializes from PHP serialized form the data element.

Apibot core

$restored_element_type (must be set at processing)

Worker_DataElement_JSONEncode

Produces an JSON-encoded form of the data element

Apibot core

The PHP JSON encoding is a superset of the standard one - things encoded by this worker might not be decoded by a non-PHP app!

Worker_DataElement_JSONDecode

Restores a data (sub)element from JSON-encoded form (must be string).

Apibot core

$restored_element_type (must be set at processing)

Worker_DataElement_UUencode

Produces an UUencoded form of the data element (must be string).

Apibot core

Worker_DataElement_UUdecode

Restores a data (sub)element from UUencoded form (must be string).

Apibot core

$restored_element_type (must be set at processing)

Math

These work on numeric data. Non-numeric data will cause the processing of the data element to stop there.

Class name

Task

Creation params

Public properties

Notes

Worker_DataElement_Math_Add

Adds a specified value to the element it copies.

Apibot core

$add

Worker_DataElement_Math_Subtract

Subtracts a specified value from the element it copies.

Apibot core

$subtract

Worker_DataElement_Math_SubtractFrom

Subtracts the element it copies from a specified value.

Apibot core

$subtract_from

Worker_DataElement_Math_Multiply

Multiplies the element it copies by a specified value.

Apibot core

$multiply

Worker_DataElement_Math_Divide

Divides the element it copies by a specified value.

Apibot core

$divide

Worker_DataElement_Math_Round

Rounds the element it copies.

Apibot core

$precision, $mode

Works through the PHP round() function

Worker_DataElement_Math_Ceil

Rounds up the element it copies.

Apibot core

Works through the PHP ceil() function

Worker_DataElement_Math_Floor

Rounds down the element it copies.

Apibot core

Works through the PHP floor() function

Worker_DataElement_Math_Frac

Returns the fractional part of the element it copies

Apibot core

Worker_DataElement_Math_Min

Returns the smaller of the copied element and a given value

Apibot core

$min

Worker_DataElement_Math_Max

Returns the larger of the copied element and a given value

Apibot core

$max

Worker_DataElement_Math_Random

Returns a random number between $min and $max

Apibot core

$min, $max

Does not use source data element

String

These work on string data. Non-string data will cause the processing of the data element to stop there.