本文整理匯總了PHP中cron::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP cron::add方法的具體用法?PHP cron::add怎麽用?PHP cron::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cron
的用法示例。
在下文中一共展示了cron::add方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Copyright
<?php
/*
[Destoon B2B System] Copyright (c) 2008-2015 www.destoon.com
This is NOT a freeware, use is subject to license.txt
*/
defined('DT_ADMIN') or exit('Access Denied');
$menus = array(array('添加任務', '?file=' . $file . '&action=add'), array('計劃任務', '?file=' . $file));
$do = new cron();
switch ($action) {
case 'add':
if ($submit) {
if ($do->pass($post)) {
$do->add($post);
dmsg('添加成功', $forward);
} else {
msg($do->errmsg);
}
} else {
$type = $title = $name = $run = $hour = $mint = $status = $note = '';
$minute = 30;
include tpl('cron_edit');
}
break;
case 'edit':
$itemid or msg();
$do->itemid = $itemid;
$r = $do->get_one();
$r or msg('任務不存在');
!$r['type'] or msg('內置任務不可修改');
if ($submit) {
示例2: define
<?php
define('SYSTEM_NO_ERROR', true);
define('SYSTEM_ONLY_CHECK_LOGIN', true);
require '../init.php';
global $m;
error_reporting(0);
if (ROLE == 'admin') {
option::set('cron_pw', '');
option::set('sign_sleep', '0');
cron::add('system_sign', array('file' => 'lib/cron_system_sign.php', 'no' => 0, 'status' => 0, 'freq' => 0, 'lastdo' => 0));
$m->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "users_options` (\n`id` int(30) NOT NULL AUTO_INCREMENT ,\n`uid` int(30) NOT NULL ,\n`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,\n`value` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,\nPRIMARY KEY (`id`)\n)\nENGINE=MyISAM\nDEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci\nAUTO_INCREMENT=2\nCHECKSUM=0\nROW_FORMAT=DYNAMIC\nDELAY_KEY_WRITE=0\n;");
$m->query("ALTER TABLE `" . DB_PREFIX . "cron`\nMODIFY COLUMN `name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `id`,\nDROP INDEX `name` ,\nADD UNIQUE INDEX `name` (`name`) ;");
$m->query("ALTER TABLE `" . DB_PREFIX . "users`\nMODIFY COLUMN `role` enum('banned','vip','user','admin') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'user' AFTER `email`;");
unlink(__FILE__);
msg('您的雲簽到已成功升級到 V3.4 版本,請立即刪除 /setup/update3.3to3.4.php,謝謝');
} else {
msg('您需要先登錄舊版本的雲簽到,才能繼續升級');
}
示例3: msg
if (ROLE == 'admin') {
$cv = option::get('core_version');
if (!empty($cv) && $cv >= '3.8') {
msg('您的雲簽到已升級到 V3.8 版本,請勿重複更新<br/><br/>請立即刪除 /setup/update3.45to3.48.php');
}
option::add('core_version', '3.8');
option::add('isapp', '0');
option::add('cron_asyn', '0');
option::add('mail_ssl', '0');
option::add('baidu_name', '1');
option::set('sign_sleep', option::get('sign_sleep') * 1000);
$m->query("CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "plugins` (\r\n`id` int(10) NOT NULL AUTO_INCREMENT ,\r\n`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,\r\n`status` tinyint(1) NOT NULL DEFAULT 0 ,\r\n`options` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL ,\r\nPRIMARY KEY (`id`),\r\nUNIQUE INDEX `name` (`name`) USING BTREE \r\n)\r\nENGINE=MyISAM\r\nDEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci\r\nCHECKSUM=0\r\nROW_FORMAT=DYNAMIC\r\nDELAY_KEY_WRITE=0\r\n;");
$plugins = unserialize(option::get('actived_plugins'));
foreach ($plugins as $plug) {
if (isset($i['opt']['plugin_' . $plug])) {
$set = $i['opt']['plugin_' . $plug];
} else {
$set = '';
}
$m->query("INSERT IGNORE INTO `" . DB_NAME . "`.`" . DB_PREFIX . "plugins` (`name`,`status`,`options`) VALUES ('{$plug}','1','{$set}');");
}
$m->query("ALTER TABLE `" . DB_PREFIX . "cron` ADD COLUMN `desc` text NULL AFTER `no`;");
$m->query("ALTER TABLE `" . DB_PREFIX . "cron` DROP COLUMN `status`;", true);
cron::aset('system_sign', array('desc' => '每天對所有貼吧進行簽到' . "\n" . '忽略或卸載此任務會導致停止簽到'));
cron::add('system_sign_retry', array('orde' => '1', 'file' => 'lib/cron_system_sign_retry.php', 'no' => '0', 'desc' => '對所有簽到失敗的貼吧進行複簽' . "\n" . '忽略或卸載此任務會導致停止複簽', 'freq' => '0'));
$m->query("ALTER TABLE `" . DB_PREFIX . "baiduid` ADD COLUMN `name` varchar(40) NULL AFTER `bduss`;");
unlink(__FILE__);
msg('您的雲簽到已成功升級到 V3.8 版本,請立即刪除 /setup/update3.45to3.8.php,謝謝<br/><br/>若要獲取 V3.8 版本新特性,請前往 <a href="http://www.stus8.com/forum.php?mod=viewthread&tid=6411">StusGame GROUP</a> ', SYSTEM_URL);
} else {
msg('您需要先登錄舊版本的雲簽到,才能繼續升級');
}