Example #1
0
     if (!is_dir($floderName)) {
         DeleteFile(UPDATE_CACHE);
         msg('错误 - 更新失败:<br/><br/>无法解压缩更新包');
     }
     //删除配置文件
     if (file_exists($floderName . '/config.php')) {
         unlink($floderName . '/config.php');
     }
     if (file_exists($floderName . '/app.conf')) {
         unlink($floderName . '/app.conf');
     }
     if (file_exists($floderName . '/config.yaml')) {
         unlink($floderName . '/config.yaml');
     }
     //覆盖文件
     if (CopyAll($floderName, SYSTEM_ROOT) !== true) {
         DeleteFile(UPDATE_CACHE);
         msg('错误 - 更新失败:<br/><br/>无法更新文件');
     }
     DeleteFile(UPDATE_CACHE);
     //获取最新的版本号
     $c = new wcurl('http://kenvix.oschina.io/tieba-cloud-sign/');
     $data = json_decode($c->exec(), true);
     $c->close();
     //修改版本号
     option::set('vid', $data['vid']);
     //暂不支持更新脚本
     msg('恭喜您,更新成功!', SYSTEM_URL . 'index.php?mod=admin:update&ok');
     break;
 case 'admin:update:changeServer':
     if (isset($_GET['server'])) {
Example #2
0
             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) {
                 msg('版本回滚失败');
             }
             unlink(SYSTEM_ROOT . '/__backup.ini');
             msg('版本回滚成功', 'index.php');
         } else {
             msg('版本回滚失败:该备份不存在或不正确');
         }
     }
     break;
 case 'admin:create_lock':
     if (!file_put_contents(SYSTEM_ROOT . '/setup/install.lock', '1')) {
         $msg = '未能放置 install.lock,请手动完成。<br/><br/>';
     } else {
         $msg = '系统成功放置 install.lock,但是如果您的环境为引擎,您必须手工放置<br/><br/>';
     }
/**
 * 批量复制
 * @param string $source 源目录名
 * @param string $destination 目的目录名
 * @return bool 成功返回TRUE,失败返回原因
 */
function CopyAll($source, $destination)
{
    if (!is_dir($source)) {
        return '错误:' . $source . '并不是一个目录';
    }
    if (!is_dir($destination)) {
        mkdir($destination, 0777, true);
    }
    $handle = dir($source);
    while ($entry = $handle->read()) {
        if ($entry !== '.' && $entry !== '..') {
            if (is_dir($source . '/' . $entry)) {
                CopyAll($source . '/' . $entry, $destination . '/' . $entry);
            } else {
                copy($source . '/' . $entry, $destination . '/' . $entry);
            }
        }
    }
    return true;
}
Example #4
0
         DeleteFile(UPDATE_CACHE);
         msg('错误 - 更新失败:<br/><br/>无法下载更新包');
     }
     //解压缩
     $z = new zip();
     $z->open($zipPath);
     $z->extract(UPDATE_CACHE);
     $z->close();
     //检查更新文件
     $floderName = UPDATE_CACHE . $_GET['upd'];
     if (!is_dir($floderName)) {
         DeleteFile(UPDATE_CACHE);
         msg('错误 - 更新失败:<br/><br/>无法解压缩更新包');
     }
     //覆盖文件
     if (CopyAll($floderName, SYSTEM_ROOT . '/plugins/' . $_GET['upd']) !== true) {
         DeleteFile(UPDATE_CACHE);
         msg('错误 - 更新失败:<br/><br/>无法更新文件');
     }
     DeleteFile(UPDATE_CACHE);
     doAction('plugin_update_2');
     msg('(1/2)已成功下载最新版本的 ' . $plug['plugin']['name'] . ' 插件。请单击下一步,以完成更新<br/><br/><a href="setting.php?mod=admin:plugins&upd=' . $_GET['upd'] . '">>> 下一步</a>', false);
     break;
 case 'admin:set':
     global $m;
     $sou = $_POST;
     if ($_GET['type'] == 'sign') {
         @option::set('cron_limit', $sou['cron_limit']);
         @option::set('tb_max', $sou['tb_max']);
         @option::set('bduss_num', $sou['bduss_num']);
         @option::set('sign_mode', serialize($sou['sign_mode']));