fix: nav
This commit is contained in:
@@ -52,12 +52,15 @@ class IndexController extends Controller
|
||||
$dbsecurity = true;
|
||||
// 如果是sqlite数据库,并且路径为默认的,则标记为不安全
|
||||
if (get_db_type() == 'sqlite') {
|
||||
// 数据库配置含有默认名字则进行修改
|
||||
if (strpos($this->config('database.dbname'), 'pbootcms') !== false) {
|
||||
if (get_user_ip() != '127.0.0.1' && $this->modDB()) { // 非本地测试时尝试自动修改数据库名称
|
||||
$dbsecurity = true;
|
||||
} else {
|
||||
$dbsecurity = false;
|
||||
}
|
||||
} elseif (file_exists(ROOT_PATH . '/data/pbootcms.db')) { // 存在多余的默认数据库文件则改名
|
||||
rename(ROOT_PATH . '/data/pbootcms.db', ROOT_PATH . '/data/' . get_uniqid() . '.db');
|
||||
}
|
||||
} elseif (file_exists(ROOT_PATH . '/data/pbootcms.db')) {
|
||||
rename(ROOT_PATH . '/data/pbootcms.db', ROOT_PATH . '/data/' . get_uniqid() . '.db');
|
||||
@@ -256,30 +259,34 @@ class IndexController extends Controller
|
||||
} else {
|
||||
$rs = (path_delete(RUN_PATH . '/cache') && path_delete(RUN_PATH . '/complile') && path_delete(RUN_PATH . '/config') && path_delete(RUN_PATH . '/upgrade') && path_delete(RUN_PATH . '/image'));
|
||||
}
|
||||
cache_config(); // 清理缓存后立即生成新的配置
|
||||
if ($rs) {
|
||||
if (extension_loaded('Zend OPcache')) {
|
||||
opcache_reset(); // 在启用了OPcache加速器时同时清理
|
||||
}
|
||||
$this->log('清理缓存成功!');
|
||||
alert_back('清理缓存成功!');
|
||||
alert_back('清理缓存成功!', 1);
|
||||
} else {
|
||||
$this->log('清理缓存失败!');
|
||||
alert_back('清理缓存失败!');
|
||||
alert_back('清理缓存失败!', 0);
|
||||
}
|
||||
}
|
||||
|
||||
// 清理会话
|
||||
public function clearSession()
|
||||
{
|
||||
$rs = path_delete(RUN_PATH . '/session');
|
||||
|
||||
if ($rs) {
|
||||
$this->log('清理会话成功!');
|
||||
alert_back('清理会话成功!');
|
||||
} else {
|
||||
$this->log('清理会话失败!');
|
||||
alert_back('清理会话失败!');
|
||||
}
|
||||
ignore_user_abort(true); // 后台运行
|
||||
set_time_limit(7200);
|
||||
ob_start();
|
||||
$output['code'] = 1;
|
||||
$output['data'] = '执行成功,后台自动清理中!';
|
||||
$output['tourl'] = '';
|
||||
echo json_encode($output);
|
||||
ob_end_flush();
|
||||
flush();
|
||||
$rs = path_delete(RUN_PATH . '/session', false, array(
|
||||
'sess_' . session_id()
|
||||
));
|
||||
}
|
||||
|
||||
// 文件上传方法
|
||||
|
||||
Reference in New Issue
Block a user