本文整理汇总了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('您需要先登录旧版本的云签到,才能继续升级');
}