} elseif (!empty($_GET['dis'])) { cron::aset($_GET['dis'], array('no' => 1)); } elseif (isset($_GET['uninst'])) { cron::del($_GET['uninst']); } elseif (isset($_GET['add'])) { if (stripos($_POST['file'], 'do.php') !== false) { msg('<h4>请不要将do.php加入到云签的计划任务中来</h4>若需签到,请用云监控监控<br/>' . SYSTEM_URL . 'do.php<br/>即可实现计划任务(cron)的效果<br/><br/>推荐云监控:<a href="http://www.aliyun.com/product/jiankong/" target="_blank">阿里云监控</a> 或 <a href="http://jk.cloud.360.cn/" target="_blank">360网站服务监控</a> 或 <a href="http://ce.baidu.com/" target="_blank">百度云观测</a><br/>如果你的服务器在国外且国内访问较慢,则推荐使用:<a href="http://www.mywebcron.com/" target="_blank">Free Web Cron Service </a>', SYSTEM_URL . 'index.php?mod=admin:cron'); } else { cron::set($_POST['name'], $_POST['file'], $_POST['no'], $_POST['status'], $_POST['freq'], $_POST['lastdo'], $_POST['log']); } } elseif (isset($_GET['run'])) { $return = cron::run($_GET['file'], $_GET['run']); cron::aset($_GET['run'], array('lastdo' => time(), 'log' => $return)); } elseif (isset($_GET['xorder'])) { foreach ($_POST['order'] as $key => $value) { cron::aset($key, array('orde' => $value)); } } doAction('cron_setting_2'); Redirect('index.php?mod=admin:cron&ok'); break; case 'admin:update:back': if (isset($_GET['del'])) { if (file_exists(SYSTEM_ROOT . '/setup/update_backup/' . $_GET['del'])) { DeleteFile(SYSTEM_ROOT . '/setup/update_backup/' . $_GET['del']); } Redirect('index.php?mod=admin:update:back&ok'); } if (isset($_GET['dir'])) { if (file_exists(SYSTEM_ROOT . '/setup/update_backup/' . $_GET['dir'] . '/__backup.ini')) { if (CopyAll(SYSTEM_ROOT . '/setup/update_backup/' . $_GET['dir'], SYSTEM_ROOT) !== true) {
if (isset($_GET['in_thread'])) { define('SYSTEM_CRON_THREAD', true); } doAction('cron_1'); if (SYSTEM_PAGE == 'runcron') { $cron = isset($_GET['cron']) ? sqladds(strip_tags($_GET['cron'])) : msg('运行失败:计划任务未指定'); $cpw = option::get('cron_pw'); $x = $m->once_fetch_array("SELECT * FROM `" . DB_PREFIX . "cron` WHERE `name` = '{$cron}';"); if (empty($x['id'])) { msg('运行失败:此计划任务不存在'); } $log = cron::run($x['file'], $x['name']); if ($x['freq'] == '-1') { cron::del($x['name']); } else { cron::aset($x['name'], array('lastdo' => time(), 'log' => $log)); } } else { $sign_multith = option::get('sign_multith'); if (!isset($_GET['donnot_sign_multith']) && !empty($sign_multith) && function_exists('fsockopen')) { for ($ii = 0; $ii < $sign_multith; $ii++) { sendRequest(SYSTEM_URL . 'do.php?donnot_sign_multith&in_thread&pw=' . $cron_pw); } } $return = ''; if (option::get('cron_last_do_time') != $today) { option::set('cron_last_do_time', $today); option::set('cron_last_do', '0'); } cron::runall(); }
/** * 按运行顺序运行所有计划任务 * */ public static function runall() { global $m; $cron = $m->query("SELECT * FROM `" . DB_NAME . "`.`" . DB_PREFIX . "cron` ORDER BY `orde` ASC "); while ($cs = $m->fetch_array($cron)) { if ($cs['no'] != '1') { if (option::get('cron_asyn')) { self::arun($cs['name']); } else { if ($cs['freq'] == '-1') { self::run($cs['file'], $cs['name']); self::del($cs['name']); } elseif (empty($cs['freq']) || empty($cs['lastdo']) || time() - $cs['lastdo'] >= $cs['freq']) { $return = self::run($cs['file'], $cs['name']); cron::aset($cs['name'], array('lastdo' => time(), 'log' => $return)); } } } } }
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('您需要先登录旧版本的云签到,才能继续升级'); }