| 1 |
<?php |
<?php |
| 2 |
// $Id: poormanscron.module,v 1.22.2.1 2009/09/29 22:31:58 davereid Exp $ $Name: $ |
// $Id: poormanscron.module,v 1.22.2.2 2009/09/29 22:36:15 davereid Exp $ $Name: $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 63 |
// Cron threshold semaphore is used to avoid errors every time the image |
// Cron threshold semaphore is used to avoid errors every time the image |
| 64 |
// callback is displayed when a previous cron is still running. |
// callback is displayed when a previous cron is still running. |
| 65 |
$threshold_semaphore = variable_get('cron_threshold_semaphore', FALSE); |
$threshold_semaphore = variable_get('cron_threshold_semaphore', FALSE); |
| 66 |
if ($threshold_semaphore = variable_get('cron_threshold_semaphore', FALSE)) { |
if ($threshold_semaphore) { |
| 67 |
if ($time - $threshold_semaphore > 3600) { |
if ($time - $threshold_semaphore > 3600) { |
| 68 |
// Either cron has been running for more than an hour or the semaphore |
// Either cron has been running for more than an hour or the semaphore |
| 69 |
// was not reset due to a database error. |
// was not reset due to a database error. |
| 75 |
} |
} |
| 76 |
else { |
else { |
| 77 |
// Run cron automatically if it has never run or threshold was crossed. |
// Run cron automatically if it has never run or threshold was crossed. |
| 78 |
$cron_last = variable_get('cron_last', NULL); |
$cron_last = variable_get('cron_last', 0); |
| 79 |
$cron_threshold = variable_get('cron_safe_threshold', 10800); |
$cron_threshold = variable_get('cron_safe_threshold', 10800); |
| 80 |
if (!isset($cron_last) || ($time - $cron_last > $cron_threshold)) { |
if ($time - $cron_last > $cron_threshold) { |
| 81 |
// Lock cron threshold semaphore. |
// Lock cron threshold semaphore. |
| 82 |
variable_set('cron_threshold_semaphore', $time); |
variable_set('cron_threshold_semaphore', $time); |
| 83 |
$cron_run = drupal_cron_run(); |
$cron_run = drupal_cron_run(); |