Files
coolcoth.com/app/Controllers/Admin/SystemController.php
T
2026-08-08 15:53:53 +08:00

25 lines
739 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Controllers\Admin;
use Core\Installer;
/** 后台:数据升级(免 SSH,等价于 bash deploy.sh 的数据初始化部分) */
class SystemController extends AdminController
{
public function index()
{
return $this->view('admin/system', ['seg' => 'system']);
}
public function upgrade()
{
if ($_SERVER['REQUEST_METHOD'] === 'POST' && csrf_check()) {
$msgs = Installer::upgrade();
$_SESSION['flash'] = ['type' => 'ok', 'msg' => '数据升级完成 ✓ ' . implode('', $msgs)];
} else {
$_SESSION['flash'] = ['type' => 'err', 'msg' => '安全校验失败,请重试'];
}
$this->redirect('admin/system');
}
}