FINAL suepr merge step : added all modules to this super repos

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 16:46:59 +02:00
7585 changed files with 1723356 additions and 18 deletions

View File

@@ -0,0 +1,14 @@
Every minute, a cron job is checked whether it should run or not.
<pre>*/10 * * * *</pre>
is equivilant of
<pre>0,10,20,30,40,50 * * * *</pre>
and runs every hour at the minutes 0,10,20,30,40,50.
If for some reason (connection congestion, server crash, etc.) that Ultimate Cron cannot launch the job, e.g. 10:30, then normally, the job won't attempted to be launched again until 10:40.
The <em>catch up</em> compensates for this, allowing the job to be launched anyway until a certain time. The <em>Catch up</em> value is in seconds, so if it is set to 300, the job will launch at 10:31-35 if it did not launch at 10:30

View File

@@ -0,0 +1 @@
Logs for each cron job are stored in database. To prevent the database from accumulating much unnecessary information, Ultimate Cron cleans up old log. How old a log entry should be, before it is removed, is controlled by this setting.

View File

@@ -0,0 +1 @@
<p>Easy hooks are shortcuts for specific implementations of cron jobs, instead of using hook_cronapi()</p>

View File

@@ -0,0 +1 @@
This is the regular cron hook for Drupal. See the Drupal documentation for this.

View File

@@ -0,0 +1,48 @@
<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>

View File

@@ -0,0 +1,11 @@
<p>The hook_cron_post_execute($function, &$hook) is invoked just after running the cron function.</p>
<h3>Example</h3>
<p>Log that node_cron is done</p>
<pre>
function hook_cron_post_execute($function, &$hook) {
if ($function == 'node_cron') {
error_log('node_cron is done');
}
}
</pre>

View File

@@ -0,0 +1,9 @@
<p>The hook_cron_post_execute_FUNCTION(&$hook) is invoked just after running the cron function.</p>
<h3>Example</h3>
<p>Log that node_cron is done</p>
<pre>
function hook_cron_post_execute_node_cron($function, &$hook) {
error_log('node_cron is done');
}
</pre>

View File

@@ -0,0 +1,15 @@
<p>The hook_cron_pre_execute($function, &$hook) is invoked just before running the cron function.</p>
<h3>Example</h3>
<p>Call another function instead of the defined</p>
<pre>
function hook_cron_pre_execute($function, &$hook) {
if ($function == 'node_cron') {
$hook['callback'] = 'mymodule_steal_cron_function_from_node_module';
}
}
function mymodule_steal_cron_function_from_node_module() {
error_log('PWNED');
}
</pre>

View File

@@ -0,0 +1,14 @@
<p>The hook_cron_pre_execute_FUNCTION(&$hook) is invoked just before running the cron function.</p>
<h3>Example</h3>
<p>Call another function instead of the defined</p>
<pre>
function hook_cron_pre_execute_node_cron(&$hook) {
$hook['callback'] = 'mymodule_steal_cron_function_from_node_module';
}
function mymodule_steal_cron_function_from_node_module() {
error_log('PWNED');
}
</pre>

View File

@@ -0,0 +1,11 @@
<p>The hook_cron_schedule_alter(&$hooks) allows you to change the cron hooks that are scheduled to be run.</p>
<h3>Example</h3>
<p>Don't run node_cron if 2 + 2 = 4</p>
<pre>
function hook_cron_schedule_alter(&$hooks) {
if (2 + 2 = 4) {
unset($hooks['node_cron']);
}
}
</pre>

View File

@@ -0,0 +1,58 @@
<p>The hook_cronapi($op, $function = NULL) allows you to define new cronjobs</p>
<h3>Example</h3>
<pre>
// Define custom cron functions
function mymodule_cronapi($op, $function = NULL) {
switch($op) {
case 'list':
return array(
'mymodule_cronjob_1' => 'Cron-1 Handler',
'mymodule_cronjob_2' => 'Cron-2 Handler',
'mymodule_cronjob_3' => 'Cron-3 Handler',
);
case 'rule':
switch($function) {
case 'mymodule_cronjob_1': return '*/13 * * * *';
case 'mymodule_cronjob_2': return '0 0 1 * *';
}
break;
case 'execute':
switch($function) {
case 'mymodule_cronjob_2':
mymodule_somefunction();
break;
}
break;
case 'settings':
switch ($function) {
// 'mymodule_cronjob_3' disabled by default
case 'mymodule_cronjob_3': return array('enabled' => FALSE);
}
case 'configure':
switch ($function) {
case 'mymodule_cronjob_3': return 'admin/configure-modules-settings/xxx';
}
}
}
// Custom cron-function
function mymodule_cronjob_1() {
// Do some stuff ...
}
// Custom cron-function
function mymodule_somefunction() {
// Do some stuff ...
}
// Custom cron-function
function mymodule_cronjob_3() {
// Do some stuff ...
}
</pre>

View File

@@ -0,0 +1,10 @@
If you just want a cron job that runs once per day by default, you can use hook_daily().
<h3>Example</h3>
<pre>
// Easy-hook, uses rule: 0 0 * * *
function mymodule_daily() {
// Do some stuff
}
</pre>

View File

@@ -0,0 +1,10 @@
If you just want a cron job that runs once per hour by default, you can use hook_hourly().
<h3>Example</h3>
<pre>
// Easy-hook, uses rule: 0 * * * *
function mymodule_hourly() {
// Do some stuff
}
</pre>

View File

@@ -0,0 +1,10 @@
If you just want a cron job that runs once a month by default, you can use hook_monthly().
<h3>Example</h3>
<pre>
// Easy-hook, uses rule: 0 0 1 * *
function mymodule_monthly() {
// Do some stuff
}
</pre>

View File

@@ -0,0 +1,10 @@
If you just want a cron job that runs once a week by default, you can use hook_weekly().
<h3>Example</h3>
<pre>
// Easy-hook, uses rule: 0 0 * * 1
function mymodule_weekly() {
// Do some stuff
}
</pre>

View File

@@ -0,0 +1,12 @@
If you just want a cron job that runs once a year by default, you can use hook_yearly().
<h3>Example</h3>
<pre>
// Easy-hook, uses rule: 0 0 1 1 *
function mymodule_yearly() {
// Do some stuff
}
</pre>
P.S.: It's okay to laugh. The use case for this hook is very likely non-existent.

View File

@@ -0,0 +1 @@
This section explains how to use the hooks implemented by Ultimate Cron.

View File

@@ -0,0 +1 @@
When setting a polling latency, Ultimate Cron continuously processing queues, and polls for new items in the queue every X miliseconds.

View File

@@ -0,0 +1 @@
For installations where it is not possible to control the systems cron tab, Poormans cron makes sure, that cron is run every minute. On each request to the server, it checks if the Poormans service is running, and if not, it launches it. The poormans cron launcher is delegated to the <em>ultimate_cron_poorman</em> service host.

View File

@@ -0,0 +1,38 @@
<h3>Fields order</h3>
<pre>
+---------------- minute (0 - 59)
| +------------- hour (0 - 23)
| | +---------- day of month (1 - 31)
| | | +------- month (1 - 12)
| | | | +---- day of week (0 - 7) (Sunday=0)
| | | | |
* * * * *
</pre>
<p>Each of the patterns from the first five fields may be either * (an asterisk),
which matches all legal values, or a list of elements separated by commas (see below).</p>
<p>For "day of the week" (field 5), 0 is considered Sunday, 6 is Saturday
(7 is an illegal value)</p>
<p>A job is executed when the time/date specification fields all match the current
time and date. There is one exception: if both "day of month" and "day of week"
are restricted (not "*"), then either the "day of month" field (3) or the "day of week"
field (5) must match the current day (even though the other of the two fields
need not match the current day).</p>
<h3>Fields operators</h3>
<p>There are several ways of specifying multiple date/time values in a field:</p>
<ul>
<li>The comma (',') operator specifies a list of values, for example: "1,3,4,7,8"</li>
<li>The dash ('-') operator specifies a range of values, for example: "1-6", which is equivalent to "1,2,3,4,5,6"</li>
<li>The asterisk ('*') operator specifies all possible values for a field. For example, an asterisk in the hour time field would be equivalent to 'every hour' (subject to matching other specified fields).</li>
<li>The slash ('/') operator (called "step") can be used to skip a given number of values. For example, "*/3" in the hour time field is equivalent to "0,3,6,9,12,15,18,21".</li>
<li>The plus ('+') operator (called "offset") can be used as an offset to a given range. For example, "*/10+2" in the hour minute field is equivalent to "2,12,22,32,42,52".</li>
</ul>
<h3>Examples</h3>
<pre>
*/15 * * * : Execute job every 15 minutes
0 2,14 * * *: Execute job every day at 2:00 and 14:00
0 2 * * 1-5: Execute job at 2:00 of every working day
0 12 1 */2 1: Execute job every 2 month, at 12:00 of first day of the month OR at every monday.
</pre>

View File

@@ -0,0 +1,3 @@
Service groups are controlled by the Background Process module.
Ultimate Cron can delegate a cron job to specific service group.

View File

@@ -0,0 +1 @@
This section contains help for all the settings in Ultimate Cron.

View File

@@ -0,0 +1 @@
Every minute, Ultimate Cron launches all scheduled jobs. To prevent congestion, it is possible to limit the amount of cron jobs running at any given time.

View File

@@ -0,0 +1,114 @@
[settings]
title = Settings
file = settings
[catch_up]
title = Catch up
file = catch_up
parent = settings
[rules]
title = Rules
file = rules
parent = settings
[polling_latency]
title = Polling latency
file = polling_latency
parent = settings
[simultaneous_connections]
title = Simultaneous connections
file = simultaneous_connections
parent = settings
[cleanup_log]
title = Cleanup log
file = cleanup_log
parent = settings
[poorman]
title = Poormans cron
file = poorman
parent = settings
[service_group]
title = Service group
file = service_group
parent = settings
[hooks]
title = Hooks
file = hooks
[hook_cron]
title = hook_cron
file = hook_cron
parent = hooks
[hook_cronapi]
title = hook_cronapi
file = hook_cronapi
parent = hooks
[hook_cron_alter]
title = hook_cron_alter
file = hook_cron_alter
parent = hooks
[hook_cron_schedule_alter]
title = hook_cron_schedule_alter
file = hook_cron_schedule_alter
parent = hooks
[hook_cron_pre_execute]
title = hook_cron_pre_execute
file = hook_cron_pre_execute
parent = hooks
[hook_cron_pre_execute_FUNCTION]
title = hook_cron_pre_execute_FUNCTION
file = hook_cron_pre_execute_function
parent = hooks
[hook_cron_post_execute]
title = hook_cron_post_execute
file = hook_cron_post_execute
parent = hooks
[hook_cron_post_execute_FUNCTION]
title = hook_cron_post_execute_FUNCTION
file = hook_cron_post_execute_function
parent = hooks
[easy_hooks]
title = Easy hooks
file = easy_hooks
parent = hooks
[hook_hourly]
title = hook_hourly
file = hook_hourly
parent = easy_hooks
[hook_daily]
title = hook_daily
file = hook_daily
parent = easy_hooks
[hook_weekly]
title = hook_weekly
file = hook_weekly
parent = easy_hooks
[hook_monthly]
title = hook_monthly
file = hook_monthly
parent = easy_hooks
[hook_yearly]
title = hook_yearly
file = hook_yearly
parent = easy_hooks