This is the base class used for all jobs run by MidCOM CRON.

It gives you an easy to use way of building cron jobs. You should rely only on the two event handlers _on_initialize and _on_execute, which are called by the cron service. Your constructor shouldn't do anything then calling the base class constructor.

See the main cron service class for details.

see \global\midcom_services_cron
package midcom.baseclasses


_on_execute ()

This is the actual handler operation, it is called only after successful operation.

You should use the print_error() helper of this class in case you need to notify the user of any errors. As long as everything goes fine, you should not print anything to avoid needles cron mailings.

_on_initialize ()

This callback is executed immediately after object construction.

You can initialize your class here. If you return false here, the handler is not executed, the system skips it.

All class members are already initialized when this event handler is called.


booleanReturns true, if initialization was successful, false if anything went wrong.

execute ()

Execute the handler, this calls the corresponding event handler.

initialize (array $config)

This initializes the cron job.

Before calling the on_initialize callback, it prepares the instance with various configuration variables and helper references.



arrayThe full cron job configuration data.

print_error (string $message, mixed $var)

This helper function echoes the error message to the client, automatically appending the classname to the prefix.

If you want to log the error, you have to take care of this yourself.



stringThe error message to print.


mixedA variable you want to print, if any.



Array $_component_data

The systemwide component data store.

Not available for midcom core cron jobs.

access protected

\midcom_baseclasses_components_interface $_component_interface

This is a reference to the Component Interface class.

It is loaded during class instantiation.

Not available for midcom core cron jobs.

access protected

Array $_handler_config

The local handler configuration as written in the Component Manifest.
access protected