本文整理汇总了PHP中cron类的典型用法代码示例。如果您正苦于以下问题:PHP cron类的具体用法?PHP cron怎么用?PHP cron使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cron类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initcronjobs
public function initcronjobs()
{
global $init;
require_once PATH_CORE . '/classes/cron.class.php';
$cObj = new cron($init['apiKey']);
$cObj->initJobs();
set_flash(array('notice' => "Finished initializing cron jobs."));
redirect(url_for($this->name, 'cronjobs'));
}
示例2: syncallocations
public function syncallocations()
{
global $init;
require_once PATH_CORE . '/classes/cron.class.php';
$cObj = new cron($init['apiKey']);
$cObj->forceJob('facebookAllocations');
echo 'Completed';
set_flash(array('notice' => "Finished synching allocations"));
redirect(url_for($this->name, 'index'));
}
示例3: downloadUrl
public static function downloadUrl($url, $path, $name)
{
if (empty($url)) {
throw new Exception('[ERROR] Class cron, function downloadUrl, $url is empty !');
}
if (empty($path)) {
throw new Exception('[ERROR] Class cron, function downloadUrl, $path is empty !');
}
cron::message(sprintf("Class cron, function downloadUrl, de volgende url word aangeroepen: %s, naar %s/%s !", $url, $path, $name));
if (!($fp = fopen($path . '/' . $name, 'w+'))) {
//This is the file where we save the information
cron::message(sprintf("Class cron, function downloadUrl, fopen error !"), 'error');
fclose($fp);
return false;
}
$ch = curl_init(str_replace(' ', '%20', $url));
//Here is the file we are downloading, replace spaces with %20
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
// write curl response to file
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if (false === curl_exec($ch)) {
cron::message(sprintf("Class cron, function downloadUrl, curl_exec error: %s", curl_error($ch)), 'error');
// Close handle
curl_close($ch);
fclose($fp);
return false;
}
// Close handle
curl_close($ch);
fclose($fp);
return true;
}
示例4: ewattch_remove
function ewattch_remove()
{
$cron = cron::byClassAndFunction('ewattch', 'pull');
if (is_object($cron)) {
$cron->remove();
}
}
示例5: tesla_remove
function tesla_remove()
{
$cron = cron::byClassAndFunction('tesla', 'pull');
if (is_object($cron)) {
$cron->remove();
}
}
示例6: run
function run()
{
//called by outside cron NOT autocron
Cron::MailFetcher();
Cron::TicketMonitor();
cron::PurgeLogs();
}
示例7: xpl_remove
function xpl_remove()
{
$cron = cron::byClassAndFunction('xpl', 'deamon');
if (is_object($cron)) {
$cron->remove();
}
}
示例8: callback_inactive
function callback_inactive()
{
global $m;
$m->query("DROP TABLE IF EXISTS `" . DB_PREFIX . "pch18_relist`");
$m->query("DELETE FROM `" . DB_NAME . "`.`" . DB_PREFIX . "options` WHERE `name`= 'relist'");
cron::del('pch18_relist');
}
示例9: health
public static function health()
{
$return = array();
$demon_state = self::deamonRunning();
$return[] = array('test' => __('Démon local', __FILE__), 'result' => $demon_state ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $demon_state ? '' : __('Peut être normal si vous êtes en déporté', __FILE__), 'state' => $demon_state);
$version = openzwave::getVersion('openzwave');
$return[] = array('test' => __('Version d\'openzwave', __FILE__), 'result' => $version, 'advice' => $demon_state ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => version_compare(config::byKey('openzwave_version', 'openzwave'), $version, '<='));
$compilation = openzwave::compilationOk();
$return[] = array('test' => __('Compilation', __FILE__), 'result' => $compilation ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $compilation ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => $compilation);
if (config::byKey('jeeNetwork::mode') == 'master') {
$cron = cron::byClassAndFunction('openzwave', 'pull');
$running = false;
if (is_object($cron)) {
$running = $cron->running();
}
$return[] = array('test' => __('Tâche Z-Wave', __FILE__), 'result' => $running ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $running ? '' : __('Allez sur la page du moteur des tâches et vérifiez lancer la tache openzwave::pull', __FILE__), 'state' => $running);
foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
try {
$demon_state = $jeeNetwork->sendRawRequest('deamonRunning', array('plugin' => 'openzwave'));
} catch (Exception $e) {
$demon_state = false;
}
$return[] = array('test' => __('Démon sur ', __FILE__) . $jeeNetwork->getName(), 'result' => $demon_state ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => '', 'state' => $demon_state);
$version = $jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave'));
$return[] = array('test' => __('Version d\'openzwave sur ', __FILE__) . $jeeNetwork->getName(), 'result' => $version, 'advice' => $demon_state ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => version_compare(config::byKey('openzwave_version', 'openzwave'), $version, '<='));
$compilation = $jeeNetwork->sendRawRequest('compilationOk', array('plugin' => 'openzwave'));
$return[] = array('test' => __('Compilation sur', __FILE__) . $jeeNetwork->getName(), 'result' => $compilation ? __('OK', __FILE__) : __('NOK', __FILE__), 'advice' => $compilation ? '' : __('Mettez à jour les dépendances', __FILE__), 'state' => $compilation);
}
}
return $return;
}
示例10: weather_update
function weather_update()
{
$crons = cron::searchClassAndFunction('weather', 'updateWeatherData');
foreach ($crons as $cron) {
$cron->remove();
}
}
示例11: domogeek_remove
function domogeek_remove()
{
$cron = cron::byClassAndFunction('domogeek', 'pull');
if (is_object($cron)) {
$cron->remove();
}
}
示例12: remove
function remove()
{
$cron = cron::byClassAndFunction('zwave', 'pull');
if (is_object($cron)) {
$cron->remove();
}
}
示例13: sonos3_remove
function sonos3_remove()
{
$cron = cron::byClassAndFunction('sonos3', 'pull');
if (is_object($cron)) {
$cron->remove();
}
}
示例14: remove
function remove()
{
$cron = cron::byId(config::byKey('xPLDeamonCronId', 'xPL'));
if (is_object($cron)) {
$cron->remove();
}
config::remove('xPLDeamonCronId', 'xPL');
}
示例15: callback_init
function callback_init()
{
option::add('wmzz_mailer_title');
option::add('wmzz_mailer_text');
option::set('wmzz_mailer_limit', '5');
option::set('wmzz_mailer_last', '0');
cron::set('wmzz_mailer', 'plugins/wmzz_mailer/wmzz_mailer_cron.php', 0, 0, 0);
}