function elysia_cron_admin_page in Elysia Cron 7
Same name and namespace in other branches
- 5.2 elysia_cron.admin.inc \elysia_cron_admin_page()
- 5 elysia_cron.admin.inc \elysia_cron_admin_page()
- 6.2 elysia_cron.admin.inc \elysia_cron_admin_page()
- 6 elysia_cron.admin.inc \elysia_cron_admin_page()
- 7.2 elysia_cron.admin.inc \elysia_cron_admin_page()
1 string reference to 'elysia_cron_admin_page'
File
- ./
elysia_cron.admin.inc, line 11
Code
function elysia_cron_admin_page() {
$aoutput = array();
$aoutput[] = drupal_get_form('elysia_cron_run_form');
$output = '';
elysia_cron_initialize();
global $elysia_cron_settings, $elysia_cron_settings_by_channel, $elysia_cron_current_channel, $cron_completed, $cron_completed_time;
$v = variable_get('elysia_cron_disabled', false);
$output .= '<p>Global disable: <i>' . ($v ? '<span class="warn">YES</span>' : 'no') . '</i></p>';
$output .= '<p>Last channel executed: <i>' . (($c = elysia_cron_last_channel()) ? $c : t('n/a')) . '</i></p>';
if (EC_DRUPAL_VERSION < 7) {
if (_ec_variable_get('elysia_cron_semaphore', 0)) {
$output .= '<p><span class="warn">Global semaphore active since ' . elysia_cron_date(_ec_variable_get('elysia_cron_semaphore', 0)) . '</span></p>';
}
}
$running = '';
foreach ($elysia_cron_settings_by_channel as $channel => $data) {
if (elysia_cron_is_channel_running($channel)) {
$running .= $channel . ' ';
}
}
if ($running) {
$output .= '<p>Running channels: <span class="warn">' . $running . '</span></p>';
}
$output .= '<p>Last run: ' . elysia_cron_date(_ec_variable_get('elysia_cron_last_run', 0)) . '</p>';
foreach ($elysia_cron_settings_by_channel as $channel => $data) {
$running = elysia_cron_is_channel_running($channel);
$output .= '<h3>Channel: ' . $channel . ($running ? ' (Running since ' . elysia_cron_date($running) . ')' : '') . ($data['#data']['disabled'] ? ' <span class="warn">(DISABLED)</span>' : '') . '</h3>';
$output .= '<p>Last run: ' . elysia_cron_date($data['#data']['last_run']) . '</p>';
$output .= '<p>Last execution time: ' . $data['#data']['last_execution_time'] . 's (Shutdown: ' . $data['#data']['last_shutdown_time'] . 's) (Avg total: ' . $data['#data']['avg_execution_time'] . 's, Max total: ' . $data['#data']['max_execution_time'] . 's)</p>';
$output .= '<p>Execution count: ' . $data['#data']['execution_count'] . '</p>';
if ($data['#data']['last_aborted']) {
$output .= '<p>Last aborted: <span class="warn">On function ' . $data['#data']['last_abort_function'] . '</span></p>';
}
if ($data['#data']['abort_count']) {
$output .= '<p>Abort count: <span class="warn">' . $data['#data']['abort_count'] . '</span></p>';
}
$rows = array();
foreach ($data as $job => $conf) {
if ($job != '#data') {
$rows[] = array(
(!empty($conf['disabled']) ? '<strike>' . $job . '</strike>' : (empty($conf['running']) ? '<b>' . $job . '</b>' : '<b><u>' . $job . '</u></b> <small title="' . t('Running') . '">(R)</small>')) . (elysia_cron_should_run($conf) ? ' <small title="' . t('Waiting for execution') . '">(w)</small>' : ''),
array(
'data' => '<i>' . elysia_cron_description($job) . '</i> ' . '[' . _dco_l(t('run'), _dcf_internal_path('admin/config/system/cron/execute/') . $job, array(
'attributes' => array(
'onclick' => 'return confirm("' . t('Force execution of !job?', array(
'!job' => $job,
)) . '");',
),
)) . ']',
'colspan' => 4,
),
);
$rows[] = array(
$conf['rule'] . (!empty($conf['weight']) ? ' <small>(' . t('Weight') . ': ' . $conf['weight'] . ')</small>' : ''),
elysia_cron_date($conf['last_run']),
$conf['last_execution_time'] . 's',
$conf['execution_count'],
$conf['avg_execution_time'] . 's / ' . $conf['max_execution_time'] . 's',
);
}
}
$output .= _dco_theme('table', array(
'header' => array(
'Job / Rule',
'Last run',
'Last exec time',
'Exec count',
'Avg/Max Exec time',
),
'rows' => $rows,
));
}
$output .= '<p>Notes: job times don\'t include shutdown times (only shown on channel times).</p>';
$output .= '<p>If an abort occours usually the job is not properly terminated, and so job timings can be inaccurate or wrong.</p>';
$aoutput[] = array(
'#type' => 'markup',
'#markup' => $output,
);
return _dcr_render_array($aoutput);
}