function run() { global $ost; Cron::run(); $ost->logDebug('Cron Job', 'Cron job executed [' . $_SERVER['REMOTE_ADDR'] . ']'); $this->response(200, 'Completed'); }
/** * * Initializes configs for the APP to run */ public static function initialize() { /** * Load all the configs from DB */ //Change the default cache system, based on your config /config/cache.php Cache::$default = Core::config('cache.default'); //is not loaded yet in Kohana::$config Kohana::$config->attach(new ConfigDB(), FALSE); //overwrite default Kohana init configs. Kohana::$base_url = Core::config('general.base_url'); //enables friendly url @todo from config Kohana::$index_file = FALSE; //cookie salt for the app Cookie::$salt = Core::config('auth.cookie_salt'); /* if (empty(Cookie::$salt)) { // @TODO missing cookie salt : add warning message } */ // -- i18n Configuration and initialization ----------------------------------------- I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset')); //Loading the OC Routes // if (($init_routes = Kohana::find_file('config','routes'))) // require_once $init_routes[0];//returns array of files but we need only 1 file //faster loading require_once APPPATH . 'config/routes.php'; //getting the selected theme, and loading options Theme::initialize(); //run crontab if (core::config('general.cron') == TRUE) { Cron::run(); } }
/** * * Initializes configs for the APP to run */ public static function initialize() { //enables friendly url Kohana::$index_file = FALSE; //temporary cookie salt in case of exception Cookie::$salt = 'cookie_oc_temp'; //Change the default cache system, based on your config /config/cache.php Cache::$default = Core::config('cache.default'); //loading configs from table config //is not loaded yet in Kohana::$config Kohana::$config->attach(new ConfigDB(), FALSE); //overwrite default Kohana init configs. Kohana::$base_url = Core::config('general.base_url'); //cookie salt for the app Cookie::$salt = Core::config('auth.cookie_salt'); // i18n Configuration and initialization I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset')); //Loading the OC Routes require_once APPPATH . 'config/routes.php'; //getting the selected theme, and loading options Theme::initialize(); //run crontab if (core::config('general.cron') == TRUE) { Cron::run(); } }
static function poorMansCron() { $intervals = array("minute", "five", "fifteen", "hour", "week"); foreach ($intervals as $interval) { $entity = getEntity(array("type" => "Cron", "metadata_name" => "interval", "metadata_value" => $interval)); if (!$entity) { $entity = new Cron(); $entity->interval = $interval; $entity->save(); } Cron::run($interval, false); } return; }
public static function init() { if (!isset($_GET['cronTok'])) { return; } define('EDUCASK_ROOT', dirname(getcwd())); require_once EDUCASK_ROOT . '/core/classes/Bootstrap.php'; Bootstrap::registerAutoloader(); $database = Database::getInstance(); $database->connect(); if (!$database->isConnected()) { return; } Bootstrap::initializePlugins(); $cron = new Cron($_GET['cronTok']); $cron->run(); }
#!/usr/bin/php -q <?php set_time_limit(0); if (!@$argc) { die("<p>script can only be run from command line"); } #error_reporting(0); define("_ABSPATH", dirname(dirname(__FILE__))); require_once _ABSPATH . '/lib/Cron.php'; define_syslog_variables(); $cron = new Cron(); $cron->run();
/** * Tests the Cron run events * * @covers \Liebig\Cron\Cron::run */ public function testAfterRunEvent() { $result = array(); \Event::listen('cron.afterRun', function ($rundate, $inTime, $runtime, $errors, $crons, $lastRun) use(&$result) { array_push($result, array($rundate, $inTime, $runtime, $errors, $crons, $lastRun)); }); Cron::add('test1', "* * * * *", function () { return 'Test 1 done'; }); Cron::add('test2', "* * * * *", function () { }); $firstRun = Cron::run(); $this->assertEquals(-1, $firstRun['inTime']); $this->assertEquals(1, $firstRun['errors']); sleep(5); $secondRun = Cron::run(); $this->assertEquals(false, $secondRun['inTime']); $this->assertEquals(1, $secondRun['errors']); // inTime $this->assertEquals(-1, $result[0][1]); $this->assertEquals(false, $result[1][1]); // errors $this->assertEquals(1, $result[0][3]); $this->assertEquals(1, $result[1][3]); // lastRun $this->assertEquals($result[0][5], array()); $secondRundate = new \DateTime($result[1][5]['rundate']); $this->assertEquals($firstRun['rundate'], $secondRundate->getTimestamp()); }
<?php /********************************************************************* cron.php File to handle cron job calls (local and remote). Peter Rotich <*****@*****.**> Copyright (c) 2006-2010 osTicket http://www.osticket.com Released under the GNU General Public License WITHOUT ANY WARRANTY. See LICENSE.TXT for details. vim: expandtab sw=4 ts=4 sts=4: $Id: $ **********************************************************************/ @chdir(realpath(dirname(__FILE__)) . '/'); //Change dir. require 'api.inc.php'; require_once INCLUDE_DIR . 'class.cron.php'; Cron::run(); Sys::log(LOG_DEBUG, 'Cron Job', 'Cron Job Externo ejecutado [' . $_SERVER['REMOTE_ADDR'] . ']');
<?php /** * Cron model * * * @package OC * @category Cron * @author Chema <*****@*****.**> * @copyright (c) 2009-2014 Open Classifieds Team * @license GPL v3 */ ignore_user_abort(TRUE); set_time_limit(0); ini_set('memory_limit', '1024M'); // Path to Kohana's index.php // REVIEW this depends on your APP is in different folder $system = dirname(dirname(dirname(dirname(__DIR__)))) . DIRECTORY_SEPARATOR . 'index.php'; //$system = '/var/www/open-classifieds/index.php'; if (file_exists($system)) { defined('SUPPRESS_REQUEST') or define('SUPPRESS_REQUEST', TRUE); include $system; //execute all the crons echo Cron::run(); }
public static function run() { Cron::run(); }
private function buildCron() { if ($this->is_cron) { require fimport("class/cron"); Cron::run(); } }
}); /* |-------------------------------------------------------------------------- | Require The Filters File |-------------------------------------------------------------------------- | | Next we will load the filters file for the application. This gives us | a nice separate location to store our route and application filter | definitions instead of putting them all in the main routes file. | */ require app_path() . '/filters.php'; /* |-------------------------------------------------------------------------- | Lieberg Cron Jobs |-------------------------------------------------------------------------- | this will help us excute all our cron job functions | | | | */ Event::listen('cron.collectJobs', function () { Cron::add('update', '* * * * *', function () { // Do some crazy things unsuccessfully every minute $orders = Order::where('activity', '=', '0')->delete(); return true; }); Cron::setEnableJob('update'); $report = Cron::run(); });
public function action_run() { $this->auto_render = FALSE; $this->template = View::factory('js'); $this->template->content = Cron::run(); }
private static function cron() { $config = Config::getInstance(); if (!$config->cronIsEnabled()) { return; } require_once EDUCASK_ROOT . "/public_html/cron.php"; $cron = new Cron(Config::getInstance()->getCronToken()); $cron->run(); }