Пример #1
0
 * Cron Scheduler for BWSC Website
 *
 *
 * @category   WebApp.Cron
 * @package    cron.php
 * @author     Huw Jones <*****@*****.**>
 * @copyright  2014 Huw Jones
 */
/*
* lib/_init.php
*/
$pass = '******';
require 'lib/_init.php';
$webapp = new WebApp();
$webapp->run();
$webapp->login('system', $pass);
if ($webapp->is_loggedIn()) {
    $webapp->cron->loadActiveJobs();
    foreach ($webapp->cron->getActiveJobs() as $jobID => $job) {
        echo "Running cron job {$jobID}...\n";
        if ($job['user'] != -1) {
            $webapp->changeUser('', '', $job['user']);
        }
        $result = $webapp->cron->runJob($jobID);
        if ($result->status) {
            echo "Job ran successfully!\n";
        } else {
            echo "Job failed to run:!\n";
            echo "  Err: " . $result->msg . "\n";
        }
        $webapp->changeUser('system', -1, $pass);