本文整理汇总了PHP中Cron::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Cron::run方法的具体用法?PHP Cron::run怎么用?PHP Cron::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cron
的用法示例。
在下文中一共展示了Cron::run方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
global $ost;
Cron::run();
$ost->logDebug('Cron Job', 'Cron job executed [' . $_SERVER['REMOTE_ADDR'] . ']');
$this->response(200, 'Completed');
}
示例2: initialize
/**
*
* 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();
}
}
示例3: initialize
/**
*
* 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();
}
}
示例4: poorMansCron
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;
}
示例5: init
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();
}
示例6: die
#!/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();
示例7: testAfterRunEvent
/**
* 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());
}
示例8: calls
<?php
/*********************************************************************
cron.php
File to handle cron job calls (local and remote).
Peter Rotich <peter@osticket.com>
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'] . ']');
示例9: ignore_user_abort
<?php
/**
* Cron model
*
*
* @package OC
* @category Cron
* @author Chema <chema@open-classifieds.com>
* @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();
}
示例10: run
public static function run()
{
Cron::run();
}
示例11: buildCron
private function buildCron()
{
if ($this->is_cron) {
require fimport("class/cron");
Cron::run();
}
}
示例12: app_path
});
/*
|--------------------------------------------------------------------------
| 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();
});
示例13: action_run
public function action_run()
{
$this->auto_render = FALSE;
$this->template = View::factory('js');
$this->template->content = Cron::run();
}
示例14: cron
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();
}