hook_cron_alter.html in Ultimate Cron 7
File
help/hook_cron_alter.html
View source
<p>The hook_cron_alter(&$hooks) allows you to change the cron hooks defined by hook_cron() and hook_cronapi().</p>
<h3>Example</h3>
<p>Change default rules for the Node modules cron hook and hi-jack system cron:</p>
<pre>
function hook_cron_alter(&$hooks) {
$hooks['node_cron']['settings']['rules'] = array('0 * * * *');
$hooks['system_cron']['module'] = 'mymodule';
$hooks['system_cron']['callback'] = 'mymodule_new_system_cron';
$hooks['system_cron']['file'] = drupal_get_path('module', 'mymodule') . '/mymodule.cron.inc';
}
</pre>
<p>Example of the Node modules cron hook data:</p>
<pre>
(
[unsafe] =>
[description] => Default cron handler
[module] => node
[configure] =>
[settings] => Array
(
[enabled] => 1
[rules] => Array
(
[0] => * * * * *
)
[catch_up] => 300
)
[function] => node_cron
[callback] => node_cron
)
</pre>
<h3>Description of data structure</h3>
<table border="1">
<tr><th>Name</th><th>Description</th></tr>
<tr><td>unsafe</td><td>If true, then the cron hook is considered unsafe, meaning that Ultimate Cron will not execute it. This value is set by Ultimate Cron when determining which hooks are unsafe. A hook is considered unsafe, if the function resides in a module with a weight lower than Ultimate Cron.</td></tr>
<tr><td>description</td><td>The description of the cron hook, usally defined in hook_cronapi(). The core modules description are added through a hook_cron_alter() in Ultimate Cron.</td></tr>
<tr><td>module</td><td>Name of the module in which the cron hook lives</td></tr>
<tr><td>configure</td><td>Link to module settings page</td></tr>
<tr><td>settings</td><td>Array with settings data, contains enabled, rules and catch_up by default, provided by Ultimate Cron</td></tr>
<tr><td>function</td><td>Name of function for the cron hook. Note: This is unsafe to change</td></tr>
<tr><td>callback</td><td>Name of callback to use when executing cron. This is set to the cron hooks function by default</td></tr>
<tr><td>file</td><td>Path to file (including filename) where callback is defined.</td></tr>
</table>