updated elysia_cron, elfinder, metatag, libraries, email_registration, migrate, nodeform_cols
This commit is contained in:
@@ -153,6 +153,8 @@ Options:
|
||||
--verbose, but without enabling drush
|
||||
verbose mode)
|
||||
--ignore-disable run channels/tasks even if disabled
|
||||
--ignore-maintenance run channels/tasks even if
|
||||
maintenance mode is enabled
|
||||
--ignore-running run channels/tasks even
|
||||
if already running
|
||||
--ignore-time run channels/tasks even if not ready
|
||||
|
@@ -10,6 +10,9 @@
|
||||
*
|
||||
* @return array
|
||||
* Renderable array.
|
||||
*
|
||||
* @throws Exception
|
||||
* Exceptions from theme().
|
||||
*/
|
||||
function elysia_cron_admin_page() {
|
||||
$aoutput = array();
|
||||
@@ -151,10 +154,26 @@ function elysia_cron_admin_page() {
|
||||
$output .= '<br />';
|
||||
|
||||
$legend_icons = array(
|
||||
'idle' => theme('image', array('path' => $ipath . 'idle.png')),
|
||||
'waiting' => theme('image', array('path' => $ipath . 'waiting.png')),
|
||||
'running' => theme('image', array('path' => $ipath . 'running.png')),
|
||||
'disabled' => theme('image', array('path' => $ipath . 'disabled.png')),
|
||||
'idle' => theme('image', array(
|
||||
'path' => $ipath . 'idle.png',
|
||||
'alt' => t('Idle'),
|
||||
'title' => t('Idle'),
|
||||
)),
|
||||
'waiting' => theme('image', array(
|
||||
'path' => $ipath . 'waiting.png',
|
||||
'alt' => t('Waiting for execution'),
|
||||
'title' => t('Waiting for execution'),
|
||||
)),
|
||||
'running' => theme('image', array(
|
||||
'path' => $ipath . 'running.png',
|
||||
'alt' => t('Running'),
|
||||
'title' => t('Running'),
|
||||
)),
|
||||
'disabled' => theme('image', array(
|
||||
'path' => $ipath . 'disabled.png',
|
||||
'alt' => t('Disabled'),
|
||||
'title' => t('Disabled'),
|
||||
)),
|
||||
);
|
||||
$output .= theme('table', array(
|
||||
'header' => array(t('Legend')),
|
||||
@@ -187,6 +206,7 @@ function elysia_cron_settings_form() {
|
||||
elysia_cron_initialize();
|
||||
|
||||
$form = array();
|
||||
$form['#attached']['js'][] = drupal_get_path('module', 'elysia_cron') . '/js/elysia_cron.js';
|
||||
|
||||
$form['prefix_1'] = array(
|
||||
'#type' => 'fieldset',
|
||||
@@ -429,14 +449,6 @@ EOT
|
||||
'#collapsible' => TRUE,
|
||||
);
|
||||
|
||||
$jobchannels = array(
|
||||
'#title' => t('Job channel associations'),
|
||||
'#description' => t('Leave empty for default channel'),
|
||||
'#type' => 'fieldset',
|
||||
'#collapsible' => TRUE,
|
||||
'#collapsed' => TRUE,
|
||||
);
|
||||
|
||||
foreach ($_elysia_cron_settings_by_channel as $channel => $cconf) {
|
||||
foreach ($cconf as $job => $conf) {
|
||||
if ($job != '#data' && empty($conf['expression'])) {
|
||||
@@ -546,12 +558,6 @@ EOT
|
||||
function theme_elysia_cron_settings_form(array &$variables) {
|
||||
$form = &$variables['form'];
|
||||
|
||||
$output = '<script type="text/javascript"><!--' . "\n" .
|
||||
'function _ec_select(key, select) { if (select.value == \'custom\') {' .
|
||||
'$ = jQuery; $("#_ec_select_"+key).hide();$("#_ec_custom_"+key).show();$("#_ec_custom_"+key).focus();' .
|
||||
'}}' .
|
||||
"\n" . '--></script>';
|
||||
|
||||
$coutput = '<table>';
|
||||
|
||||
$i = 0;
|
||||
@@ -579,7 +585,8 @@ function theme_elysia_cron_settings_form(array &$variables) {
|
||||
$form['single_job'][$c]['_elysia_cron_seljob_rule_' . $key]['#suffix'] = '</span>';
|
||||
$form['single_job'][$c]['_elysia_cron_seljob_rule_' . $key]['#title'] = NULL;
|
||||
$form['single_job'][$c]['_elysia_cron_seljob_rule_' . $key]['#description'] = NULL;
|
||||
$form['single_job'][$c]['_elysia_cron_seljob_rule_' . $key]['#attributes']['onchange'] = '_ec_select(\'' . $key . '\', this)';
|
||||
$form['single_job'][$c]['_elysia_cron_seljob_rule_' . $key]['#attributes']['class'][] = 'ec-select';
|
||||
$form['single_job'][$c]['_elysia_cron_seljob_rule_' . $key]['#attributes']['data-key'] = $key;
|
||||
|
||||
$form['single_job'][$c]['_elysia_cron_job_weight_' . $key]['#title'] = NULL;
|
||||
$form['single_job'][$c]['_elysia_cron_job_weight_' . $key]['#description'] = NULL;
|
||||
@@ -631,7 +638,7 @@ function theme_elysia_cron_settings_form(array &$variables) {
|
||||
|
||||
$form['channels']['#children'] = $coutput;
|
||||
|
||||
return $output . drupal_render_children($form);
|
||||
return drupal_render_children($form);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -5,6 +5,8 @@
|
||||
* Ctools integration.
|
||||
*/
|
||||
|
||||
define('ELYSIA_CRON_CTOOLS_LINEBREAK', "\n");
|
||||
|
||||
/**
|
||||
* Get default cron jobs.
|
||||
*
|
||||
@@ -203,13 +205,13 @@ function elysia_cron_ctools_export_callback($object, $indent) {
|
||||
$schema = ctools_export_get_schema($table);
|
||||
$identifier = $schema['export']['identifier'];
|
||||
|
||||
$output = $indent . '$' . $identifier . ' = new ' . get_class($object) . ';' . PHP_EOL;
|
||||
$output = $indent . '$' . $identifier . ' = new ' . get_class($object) . '();' . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
|
||||
if ($schema['export']['can disable']) {
|
||||
$output .= $indent . '$' . $identifier . '->disabled = FALSE; /* Edit this to true to make a default ' . $identifier . ' disabled initially */' . PHP_EOL;
|
||||
$output .= $indent . '$' . $identifier . '->disabled = FALSE; /* Edit this to true to make a default ' . $identifier . ' disabled initially */' . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
}
|
||||
if (!empty($schema['export']['api']['current_version'])) {
|
||||
$output .= $indent . '$' . $identifier . '->api_version = ' . $schema['export']['api']['current_version'] . ';' . PHP_EOL;
|
||||
$output .= $indent . '$' . $identifier . '->api_version = ' . $schema['export']['api']['current_version'] . ';' . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
}
|
||||
|
||||
$fields = $schema['fields'];
|
||||
@@ -222,7 +224,7 @@ function elysia_cron_ctools_export_callback($object, $indent) {
|
||||
if (!is_null($value) && $info['type'] == 'int') {
|
||||
$value = (isset($info['size']) && $info['size'] == 'tiny') ? (bool) $value : (int) $value;
|
||||
}
|
||||
$output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ';' . PHP_EOL;
|
||||
$output .= $indent . '$' . $identifier . '->' . $field . ' = ' . ctools_var_export($value, $indent) . ';' . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
}
|
||||
|
||||
return $output;
|
||||
@@ -253,19 +255,19 @@ function elysia_cron_ctools_to_hook_code(array $names, $name) {
|
||||
$objects = array_intersect_key($objects, array_flip($names));
|
||||
|
||||
if ($objects) {
|
||||
$output = '/**' . PHP_EOL;
|
||||
$output .= " * Implementation of hook_{$export['default hook']}()" . PHP_EOL;
|
||||
$output .= ' */' . PHP_EOL;
|
||||
$output .= "function " . $name . "_{$export['default hook']}() {" . PHP_EOL;
|
||||
$output .= " \${$export['identifier']}s = array();" . PHP_EOL . PHP_EOL;
|
||||
$output = '/**' . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
$output .= " * Implementation of hook_{$export['default hook']}()" . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
$output .= ' */' . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
$output .= "function " . $name . "_{$export['default hook']}() {" . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
$output .= " \${$export['identifier']}s = array();" . ELYSIA_CRON_CTOOLS_LINEBREAK . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
|
||||
foreach ($objects as $object) {
|
||||
$output .= ctools_export_crud_export($table, $object, ' ');
|
||||
$output .= " \${$export['identifier']}s['" . check_plain($object->{$export['key']}) . "'] = \${$export['identifier']};" . PHP_EOL . PHP_EOL;
|
||||
$output .= " \${$export['identifier']}s['" . check_plain($object->{$export['key']}) . "'] = \${$export['identifier']};" . ELYSIA_CRON_CTOOLS_LINEBREAK . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
}
|
||||
|
||||
$output .= " return \${$export['identifier']}s;" . PHP_EOL;
|
||||
$output .= '}' . PHP_EOL;
|
||||
$output .= " return \${$export['identifier']}s;" . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
$output .= '}' . ELYSIA_CRON_CTOOLS_LINEBREAK;
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
@@ -63,7 +63,9 @@ function elysia_cron_drush_command() {
|
||||
'quiet' => 'suppress all output',
|
||||
'verbose' => 'enable extended output',
|
||||
'elysia-cron-verbose' => 'enable extended output (the same as --verbose, but without enabling drush verbose mode)',
|
||||
'force' => 'run channels/tasks even if it disabled/not ready for execution/already running',
|
||||
'ignore-disable' => 'run channels/tasks even if disabled',
|
||||
'ignore-maintenance' => 'run channels/tasks even if maintenance mode is enabled',
|
||||
'ignore-time' => 'run channels/tasks even if not ready for execution',
|
||||
'ignore-running' => 'run channels/tasks even if already running',
|
||||
),
|
||||
@@ -79,8 +81,10 @@ function elysia_cron_drush_command() {
|
||||
function drush_elysia_cron_run_wrapper($op = FALSE, $target = FALSE) {
|
||||
global $_elysia_cron_drush;
|
||||
|
||||
$force = drush_get_option('force', FALSE);
|
||||
if (variable_get('maintenance_mode', FALSE)) {
|
||||
if (!variable_get('elysia_cron_run_maintenance', FALSE)) {
|
||||
$ignore_maintenance = $force || drush_get_option('ignore-maintenance', FALSE);
|
||||
if (!$ignore_maintenance && !variable_get('elysia_cron_run_maintenance', FALSE)) {
|
||||
drush_set_error('Cron run is not allowed in maintenance mode');
|
||||
return;
|
||||
}
|
||||
@@ -91,7 +95,16 @@ function drush_elysia_cron_run_wrapper($op = FALSE, $target = FALSE) {
|
||||
if (!$verbose) {
|
||||
$verbose = drush_get_option('elysia-cron-verbose', FALSE);
|
||||
}
|
||||
$_elysia_cron_drush = $quiet ? 1 : !$verbose ? 2 : 3;
|
||||
|
||||
if ($quiet) {
|
||||
$_elysia_cron_drush = 1;
|
||||
}
|
||||
elseif ($verbose) {
|
||||
$_elysia_cron_drush = 3;
|
||||
}
|
||||
else {
|
||||
$_elysia_cron_drush = 2;
|
||||
}
|
||||
|
||||
switch ($op) {
|
||||
case 'list':
|
||||
@@ -140,13 +153,18 @@ function drush_elysia_cron_run_wrapper($op = FALSE, $target = FALSE) {
|
||||
break;
|
||||
|
||||
case 'run':
|
||||
// Collect options.
|
||||
$ignore_disable = $force || drush_get_option('ignore-disable', FALSE);
|
||||
$ignore_time = $force || drush_get_option('ignore-time', FALSE);
|
||||
$ignore_running = $force || drush_get_option('ignore-running', FALSE);
|
||||
|
||||
if (empty($target)) {
|
||||
elysia_cron_run(FALSE, drush_get_option('ignore-disable', FALSE), drush_get_option('ignore-time', FALSE), drush_get_option('ignore-running', FALSE));
|
||||
elysia_cron_run(FALSE, $ignore_disable, $ignore_time, $ignore_running);
|
||||
}
|
||||
elseif (strpos($target, '@') === 0) {
|
||||
elysia_cron_initialize();
|
||||
if (elysia_cron_channel_exists(substr($target, 1))) {
|
||||
elysia_cron_run_channel(substr($target, 1), drush_get_option('ignore-disable', FALSE), drush_get_option('ignore-time', FALSE), drush_get_option('ignore-running', FALSE));
|
||||
elysia_cron_run_channel(substr($target, 1), $ignore_disable, $ignore_time, $ignore_running);
|
||||
}
|
||||
else {
|
||||
drush_set_error('Channel ' . substr($target, 1) . ' does not exists');
|
||||
@@ -155,7 +173,7 @@ function drush_elysia_cron_run_wrapper($op = FALSE, $target = FALSE) {
|
||||
else {
|
||||
elysia_cron_initialize();
|
||||
if (elysia_cron_job_exists($target)) {
|
||||
elysia_cron_run_job($target, drush_get_option('ignore-disable', FALSE), drush_get_option('ignore-time', FALSE), drush_get_option('ignore-running', FALSE));
|
||||
elysia_cron_run_job($target, $ignore_disable, $ignore_time, $ignore_running);
|
||||
}
|
||||
else {
|
||||
drush_set_error('Job ' . $target . ' does not exists');
|
||||
|
@@ -4,9 +4,8 @@ core = 7.x
|
||||
|
||||
configure = admin/config/system/cron
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-11-23
|
||||
version = "7.x-2.4"
|
||||
; Information added by Drupal.org packaging script on 2019-04-24
|
||||
version = "7.x-2.7"
|
||||
core = "7.x"
|
||||
project = "elysia_cron"
|
||||
datestamp = "1479877741"
|
||||
|
||||
datestamp = "1556076200"
|
||||
|
@@ -64,14 +64,15 @@ function elysia_cron_menu() {
|
||||
*/
|
||||
function elysia_cron_menu_alter(&$items) {
|
||||
// Override default cron page.
|
||||
$items['admin/config/system/cron'] = array(
|
||||
'title' => 'Cron Settings',
|
||||
'description' => 'View and manage cron table',
|
||||
'page callback' => 'elysia_cron_admin_page',
|
||||
'access callback' => 'elysia_cron_access',
|
||||
'access arguments' => array('view elysia_cron'),
|
||||
'file' => NULL,
|
||||
) + $items['admin/config/system/cron'];
|
||||
$items['admin/config/system/cron']['title'] = 'Cron Settings';
|
||||
$items['admin/config/system/cron']['description'] = 'View and manage cron table';
|
||||
$items['admin/config/system/cron']['page callback'] = 'elysia_cron_admin_page';
|
||||
$items['admin/config/system/cron']['access callback'] = 'elysia_cron_access';
|
||||
$items['admin/config/system/cron']['access arguments'] = array('view elysia_cron');
|
||||
$items['admin/config/system/cron']['file'] = NULL;
|
||||
|
||||
$items['admin/reports/status/run-cron']['page callback'] = 'elysia_cron_run_manually';
|
||||
$items['admin/reports/status/run-cron']['file'] = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +114,7 @@ function elysia_cron_permission() {
|
||||
'administer elysia_cron' => array(
|
||||
'title' => t('Administer elysia cron'),
|
||||
'description' => t('Perform changes to cron jobs timings, disable cron or single jobs and access cron execution statistics'),
|
||||
'restrict access' => TRUE,
|
||||
'restrict access' => TRUE,
|
||||
),
|
||||
'execute elysia_cron' => array(
|
||||
'title' => t('Execute elysia cron jobs'),
|
||||
@@ -143,6 +144,12 @@ function elysia_cron_exit() {
|
||||
function elysia_cron_cron() {
|
||||
global $_elysia_cron_exit_phase, $_elysia_cron_drush;
|
||||
|
||||
// First cron run is executed in standard drupal way.
|
||||
// This is to enable the use of install profiles.
|
||||
if (variable_get('cron_last', 0) <= variable_get('install_time', 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If cron has been executed via "drush core-cron" or any other custom drush
|
||||
// command then we run internal cron handler which is designed to handle
|
||||
// cron executions from drush.
|
||||
@@ -150,11 +157,6 @@ function elysia_cron_cron() {
|
||||
elysia_cron_drush_invoke();
|
||||
}
|
||||
|
||||
// First cron run is executed in standard drupal way.
|
||||
// This is to enable the use of install profiles.
|
||||
if (variable_get('cron_last', 0) <= variable_get('install_time', 0)) {
|
||||
return;
|
||||
}
|
||||
// If the path is 'admin/*', or if the user is not anonymous,
|
||||
// this is a manual cron run (probably by admin/logs/status),
|
||||
// but not if we are in the exit phase (= this a "poormanscron" run).
|
||||
@@ -187,7 +189,7 @@ function elysia_cron_cron() {
|
||||
variable_set('cron_last', time());
|
||||
}
|
||||
|
||||
exit();
|
||||
drupal_exit();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,8 +240,11 @@ $GLOBALS['_ec_variables_allowed'] = array(
|
||||
*/
|
||||
function _ec_variable_init() {
|
||||
global $_ec_variables, $_ec_variables_allowed;
|
||||
|
||||
$_ec_variables = array();
|
||||
$_ec_variables = array_map('unserialize', db_query("SELECT name, value FROM {variable} where name like '" . implode("' or name like '", $_ec_variables_allowed) . "'")->fetchAllKeyed());
|
||||
foreach ($_ec_variables_allowed as $name) {
|
||||
$_ec_variables[$name] = variable_get($name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -925,7 +930,7 @@ function elysia_cron_debug($message, $vars = array(), $type = WATCHDOG_NOTICE) {
|
||||
if ($type < WATCHDOG_NOTICE || variable_get('elysia_cron_debug_messages', 0)) {
|
||||
watchdog('cron', $message, $vars, $type);
|
||||
}
|
||||
if (!empty($_elysia_cron_drush) && $_elysia_cron_drush >= 2 && ($type >= WATCHDOG_NOTICE || !drush_get_option("verbose", FALSE))) {
|
||||
if (!empty($_elysia_cron_drush) && $_elysia_cron_drush >= 2 && ($type >= WATCHDOG_NOTICE || drush_get_option("verbose", FALSE))) {
|
||||
if ($type >= WATCHDOG_NOTICE) {
|
||||
drush_print(strip_tags(dt($message, $vars)));
|
||||
}
|
||||
@@ -1143,7 +1148,7 @@ function elysia_cron_prepare_run($manual_run, $start = TRUE) {
|
||||
|
||||
// Try to allocate enough time to run all the hook_cron implementations.
|
||||
if (!ini_get('safe_mode') && _elysia_cron_function_available('set_time_limit')) {
|
||||
set_time_limit(variable_get('elysia_cron_time_limit', 240));
|
||||
@set_time_limit(variable_get('elysia_cron_time_limit', 240));
|
||||
}
|
||||
|
||||
// Prevent session information from being saved while cron is running.
|
||||
@@ -1294,6 +1299,21 @@ function elysia_cron_run($manual_run = FALSE, $ignore_disable = FALSE, $ignore_t
|
||||
return $execute;
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu callback: run cron manually.
|
||||
*/
|
||||
function elysia_cron_run_manually() {
|
||||
// Run cron manually
|
||||
if (elysia_cron_run(TRUE)) {
|
||||
drupal_set_message(t('Cron ran successfully.'));
|
||||
}
|
||||
else {
|
||||
drupal_set_message(t('Cron run failed.'), 'error');
|
||||
}
|
||||
|
||||
drupal_goto('admin/reports/status');
|
||||
}
|
||||
|
||||
/**
|
||||
* Public function to execute all jobs in a channel.
|
||||
*
|
||||
@@ -1303,6 +1323,9 @@ function elysia_cron_run($manual_run = FALSE, $ignore_disable = FALSE, $ignore_t
|
||||
* Run channel (and all it's jobs) job even if not ready.
|
||||
* @param bool $ignore_running
|
||||
* Run the channel (and all it's jobs) even if already running.
|
||||
*
|
||||
* @return bool
|
||||
* Result of execution.
|
||||
*/
|
||||
function elysia_cron_run_channel($channel, $ignore_disable = FALSE, $ignore_time = FALSE, $ignore_running = FALSE) {
|
||||
global $_elysia_cron_settings_by_channel;
|
||||
@@ -1530,7 +1553,8 @@ function elysia_cron_check_run_job($job) {
|
||||
/**
|
||||
* Find an idle channel (not running, or stuck). If found one, set it as running and returns available jobs.
|
||||
*
|
||||
* @return if found returns array { 'name' => name of channel, 'jobs' => array of active jobs }, else return FALSE
|
||||
* @return array|bool
|
||||
* If found returns array { 'name' => name of channel, 'jobs' => array of active jobs }, else return FALSE.
|
||||
*/
|
||||
function elysia_cron_run_available_channel($ignore_disable = FALSE, $ignore_time = FALSE, $ignore_running = FALSE) {
|
||||
global $_elysia_cron_settings_by_channel;
|
||||
@@ -1592,7 +1616,7 @@ function elysia_cron_execute_aborted($channel) {
|
||||
* Used for unexpected termination of code.
|
||||
*/
|
||||
function elysia_cron_internal_execute_channel_cleanup() {
|
||||
global $_elysia_cron_settings, $_elysia_cron_current_channel, $_cron_completed, $_cron_completed_time;
|
||||
global $_elysia_cron_current_channel, $_cron_completed;
|
||||
|
||||
if ($_cron_completed) {
|
||||
return;
|
||||
@@ -1825,16 +1849,16 @@ function elysia_cron_ping_page() {
|
||||
$max_interval = variable_get('elysia_cron_alert_interval', 60) * 60;
|
||||
|
||||
if ($diff > $max_interval) {
|
||||
return drupal_not_found();
|
||||
}
|
||||
else {
|
||||
$aoutput = array();
|
||||
$aoutput[] = array(
|
||||
'#type' => 'markup',
|
||||
'#markup' => t('Cron has been called within maximum lapse time.'),
|
||||
);
|
||||
return $aoutput;
|
||||
drupal_not_found();
|
||||
drupal_exit();
|
||||
}
|
||||
|
||||
$aoutput = array();
|
||||
$aoutput[] = array(
|
||||
'#type' => 'markup',
|
||||
'#markup' => t('Cron has been called within maximum lapse time.'),
|
||||
);
|
||||
return $aoutput;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -1842,6 +1866,9 @@ function elysia_cron_ping_page() {
|
||||
* ONLY FOR D7
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* Implements hook_cronapi().
|
||||
*/
|
||||
function elysia_cron_cronapi($op, $job = FALSE) {
|
||||
$items = array();
|
||||
|
||||
@@ -1879,6 +1906,14 @@ function elysia_cron_cronapi($op, $job = FALSE) {
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for cronapi.
|
||||
*
|
||||
* @param string $queue_name
|
||||
* Queue name.
|
||||
* @param array $info
|
||||
* Info about queue.
|
||||
*/
|
||||
function elysia_cron_queue_exec($queue_name, $info) {
|
||||
$function = $info['worker callback'];
|
||||
$end = time() + (isset($info['time']) ? $info['time'] : 15);
|
||||
@@ -1908,6 +1943,9 @@ function elysia_cron_queue_exec($queue_name, $info) {
|
||||
* Array of links under admin/* that were removed by
|
||||
* admin_menu_adjust_items(). If one of these links is added back,
|
||||
* it should be removed from the array.
|
||||
*
|
||||
* @return array
|
||||
* Links array.
|
||||
*/
|
||||
function elysia_cron_admin_menu(&$deleted) {
|
||||
$links = array();
|
||||
|
@@ -9,8 +9,6 @@
|
||||
* Function for cron run schedule.
|
||||
*/
|
||||
function elysia_cron_should_run($conf, $now = -1, $ignore_disable = FALSE, $ignore_time = FALSE) {
|
||||
// What time SHOULD the job be executed last time.
|
||||
$prev_rule_run = 0;
|
||||
if (!$ignore_disable && $conf['disabled']) {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -53,17 +51,17 @@ function _elysia_cron_next_run($conf) {
|
||||
|
||||
$rule = array($rules[1], $rules[2], array($rules[3], $rules[5]), $rules[4]);
|
||||
$ruledec = array();
|
||||
$date = __cronDecodeDate($conf['last_run'], 1);
|
||||
$expected_date = __cronDecodeDate(!empty($conf['last_run_expected']) ? $conf['last_run_expected'] : 0);
|
||||
$date = _cronDecodeDate($conf['last_run'], 1);
|
||||
$expected_date = _cronDecodeDate(!empty($conf['last_run_expected']) ? $conf['last_run_expected'] : 0);
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
if ($i != 2) {
|
||||
// Standard scheme for mins, hours, month.
|
||||
$ruledec[$i] = __cronDecodeRule($rule[$i], $ranges[$i][0], $ranges[$i][1]);
|
||||
$ruledec[$i] = _cronDecodeRule($rule[$i], $ranges[$i][0], $ranges[$i][1]);
|
||||
}
|
||||
else {
|
||||
// For mday+week we follow another scheme.
|
||||
$ruledec[$i] = __cronDecodeRuleMday($rule[2], $date[3], $date[4]);
|
||||
$ruledec[$i] = _cronDecodeRuleMday($rule[2], $date[3], $date[4]);
|
||||
}
|
||||
$r = $ruledec[$i];
|
||||
$new = $date[$i];
|
||||
@@ -74,7 +72,7 @@ function _elysia_cron_next_run($conf) {
|
||||
$new = $expected_date[$i] + ceil(($date[$i] - $expected_date[$i]) / $r['d']) * $r['d'];
|
||||
}
|
||||
elseif ($r['n']) {
|
||||
$new = __cronNextOrEqual($date[$i], $r['n'], $ranges[$i][0], $ranges[$i][1]);
|
||||
$new = _cronNextOrEqual($date[$i], $r['n'], $ranges[$i][0], $ranges[$i][1]);
|
||||
}
|
||||
if ($new != $date[$i]) {
|
||||
$date[$i] = $new;
|
||||
@@ -85,7 +83,7 @@ function _elysia_cron_next_run($conf) {
|
||||
for ($j = 0; $j < $i; $j++) {
|
||||
if ($j == 2) {
|
||||
// For mday+week decoded rule could be changed (by month+year)
|
||||
$ruledec[$j] = __cronDecodeRuleMday($rule[2], $date[3], $date[4]);
|
||||
$ruledec[$j] = _cronDecodeRuleMday($rule[2], $date[3], $date[4]);
|
||||
}
|
||||
$date[$j] = $ruledec[$j]['d'] ? ($ranges[$j][0] == 0 ? 0 : $ruledec[$j]['d']) : ($ruledec[$j]['n'] ? reset($ruledec[$j]['n']) : $ranges[$j][0]);
|
||||
$expected_date[$j] = 0;
|
||||
@@ -93,13 +91,13 @@ function _elysia_cron_next_run($conf) {
|
||||
}
|
||||
}
|
||||
|
||||
return __cronEncodeDate($date);
|
||||
return _cronEncodeDate($date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for _elysia_cron_next_run().
|
||||
*/
|
||||
function __cronDecodeDate($timestamp, $min_diff = 0) {
|
||||
function _cronDecodeDate($timestamp, $min_diff = 0) {
|
||||
$time = floor($timestamp / 60);
|
||||
$time += $min_diff;
|
||||
|
||||
@@ -117,14 +115,14 @@ function __cronDecodeDate($timestamp, $min_diff = 0) {
|
||||
/**
|
||||
* Helper function for _elysia_cron_next_run().
|
||||
*/
|
||||
function __cronEncodeDate($date) {
|
||||
function _cronEncodeDate($date) {
|
||||
return mktime($date[1], $date[0], 0, $date[3], $date[2], $date[4]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for _elysia_cron_next_run().
|
||||
*/
|
||||
function __cronNextOrEqual($el, $arr, $range_start, $range_end) {
|
||||
function _cronNextOrEqual($el, $arr, $range_start, $range_end) {
|
||||
if (empty($arr)) {
|
||||
return $el;
|
||||
}
|
||||
@@ -139,7 +137,7 @@ function __cronNextOrEqual($el, $arr, $range_start, $range_end) {
|
||||
/**
|
||||
* Helper function for _elysia_cron_next_run().
|
||||
*/
|
||||
function __cronDecodeRule($rule, $min, $max) {
|
||||
function _cronDecodeRule($rule, $min, $max) {
|
||||
if ($rule == '*') {
|
||||
return array('n' => array(), 'd' => 0);
|
||||
}
|
||||
@@ -163,11 +161,11 @@ function __cronDecodeRule($rule, $min, $max) {
|
||||
/**
|
||||
* Helper function for _elysia_cron_next_run().
|
||||
*/
|
||||
function __cronDecodeRuleMday($rule, $month, $year) {
|
||||
function _cronDecodeRuleMday($rule, $month, $year) {
|
||||
$range_from = 1;
|
||||
$range_to = $month != 2 ? (in_array($month, array(4, 6, 9, 11)) ? 30 : 31) : ($year % 4 == 0 ? 29 : 28);
|
||||
$r1 = __cronDecodeRule($rule[0], $range_from, $range_to);
|
||||
$r2 = __cronDecodeRule($rule[1], $range_from, $range_to);
|
||||
$r1 = _cronDecodeRule($rule[0], $range_from, $range_to);
|
||||
$r2 = _cronDecodeRule($rule[1], $range_from, $range_to);
|
||||
if ($r2['d']) {
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
if ($i % $r2['d'] == 0) {
|
||||
@@ -178,7 +176,7 @@ function __cronDecodeRuleMday($rule, $month, $year) {
|
||||
if ($r2['n']) {
|
||||
$r2['n'] = array_unique($r2['n']);
|
||||
// Use always "31" and not $range_to, see http://drupal.org/node/1668302.
|
||||
$r1['n'] = array_merge($r1['n'], __cronMonDaysFromWeekDays($year, $month, $r2['n']), __cronMonDaysFromWeekDays($year, $month + 1, $r2['n'], 31));
|
||||
$r1['n'] = array_merge($r1['n'], _cronMonDaysFromWeekDays($year, $month, $r2['n']), _cronMonDaysFromWeekDays($year, $month + 1, $r2['n'], 31));
|
||||
}
|
||||
return $r1;
|
||||
}
|
||||
@@ -186,7 +184,7 @@ function __cronDecodeRuleMday($rule, $month, $year) {
|
||||
/**
|
||||
* Helper function for _elysia_cron_next_run().
|
||||
*/
|
||||
function __cronMonDaysFromWeekDays($year, $mon, $weekdays, $offset = 0) {
|
||||
function _cronMonDaysFromWeekDays($year, $mon, $weekdays, $offset = 0) {
|
||||
if ($mon > 12) {
|
||||
$year++;
|
||||
$mon = $mon - 12;
|
||||
@@ -350,15 +348,15 @@ function test_elysia_cron_should_run() {
|
||||
'last_run' => mktime(23, 59, 0, 2, 29, 2008),
|
||||
), mktime(23, 59, 0, 2, 6, 2009))));
|
||||
dprint("34." . (TRUE == elysia_cron_should_run(array(
|
||||
'rule' => '59 23 *' . '/10 * *',
|
||||
'rule' => '59 23 */10 * *',
|
||||
'last_run' => mktime(23, 58, 0, 1, 10, 2008),
|
||||
), mktime(23, 59, 0, 1, 10, 2008))));
|
||||
dprint("35." . (FALSE == elysia_cron_should_run(array(
|
||||
'rule' => '59 23 *' . '/10 * *',
|
||||
'rule' => '59 23 */10 * *',
|
||||
'last_run' => mktime(23, 59, 0, 1, 10, 2008),
|
||||
), mktime(23, 59, 0, 1, 11, 2008))));
|
||||
dprint("36." . (TRUE == elysia_cron_should_run(array(
|
||||
'rule' => '59 23 *' . '/10 * *',
|
||||
'rule' => '59 23 */10 * *',
|
||||
'last_run' => mktime(23, 59, 0, 1, 10, 2008),
|
||||
), mktime(23, 59, 0, 1, 20, 2008))));
|
||||
dprint("37." . (TRUE == elysia_cron_should_run(array(
|
||||
|
16
sites/all/modules/contrib/dev/elysia_cron/js/elysia_cron.js
Normal file
16
sites/all/modules/contrib/dev/elysia_cron/js/elysia_cron.js
Normal file
@@ -0,0 +1,16 @@
|
||||
(function ($) {
|
||||
|
||||
Drupal.behaviors.elysiaCron = {
|
||||
attach: function (context, settings) {
|
||||
$('.ec-select').once().change(function () {
|
||||
if (this.value === 'custom') {
|
||||
var key = $(this).data('key');
|
||||
|
||||
$("#_ec_select_" + key).hide();
|
||||
$("#_ec_custom_" + key).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
})(jQuery);
|
Reference in New Issue
Block a user