Exemplo n.º 1
0
        // We have EXITed already at this point!!
        break;
    case 'view':
        $cjob_ID = param('cjob_ID', 'integer', true);
        $sql = 'SELECT *
							 FROM T_cron__task LEFT JOIN T_cron__log ON ctsk_ID = clog_ctsk_ID
							WHERE ctsk_ID = ' . $cjob_ID;
        $cjob_row = $DB->get_row($sql, OBJECT, 0, 'Get cron job and log');
        if (empty($cjob_row)) {
            $Messages->add(sprintf(T_('Job #%d does not exist any longer.'), $cjob_ID), 'error');
            $action = 'list';
        }
        break;
    case 'list':
        // Detect timed out tasks:
        detect_timeout_cron_jobs();
        break;
}
$AdminUI->breadcrumbpath_init(false);
// fp> I'm playing with the idea of keeping the current blog in the path here...
$AdminUI->breadcrumbpath_add(T_('System'), '?ctrl=system');
$AdminUI->breadcrumbpath_add(T_('Scheduler'), '?ctrl=crontab');
if (in_array($action, array('new', 'create', 'edit', 'update', 'copy'))) {
    // load date picker style for cronjob.form.php
    require_css('ui.datepicker.css');
}
// Display <html><head>...</head> section! (Note: should be done early if actions do not redirect)
$AdminUI->disp_html_head();
// Display title, menu, messages, etc. (Note: messages MUST be displayed AFTER the actions)
$AdminUI->disp_body_top();
// Begin payload block:
Exemplo n.º 2
0
        }
        // Record task as finished:
        if (empty($timestop)) {
            $timestop = time() + $time_difference;
        }
        if (is_array($result_message)) {
            // If result is array we should store it as serialized data
            $result_message = serialize($result_message);
        }
        $sql = ' UPDATE T_cron__log
								SET clog_status = ' . $DB->quote($result_status) . ',
										clog_realstop_datetime = ' . $DB->quote(date2mysql($timestop)) . ',
										clog_messages = ' . $DB->quote($result_message) . '
							WHERE clog_ctsk_ID = ' . $ctsk_ID;
        $DB->query($sql, 'Record task as finished.');
    }
}
//echo 'detecting timeouts...';
// Detect timed out tasks:
detect_timeout_cron_jobs($error_task);
if (!$is_cli) {
    // This is a web request:
    echo '<p><a href="cron_exec.php">Refresh Now!</a></p>';
    echo '<p>This page should refresh automatically in 15 seconds...</p>';
    echo '<!-- This is invalid HTML but it is SOOOOOO helpful! (Delay will be triggered when we reach that point -->';
    echo '<meta http-equiv="Refresh" content="15" />';
    ?>
	</body>
	</html>
	<?php 
}