mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 03:17:23 +08:00
install&update add lock file
This commit is contained in:
@@ -632,4 +632,16 @@ class Install
|
||||
return compact('version', 'match');
|
||||
}
|
||||
|
||||
public function checkLock($path)
|
||||
{
|
||||
if (file_exists("$path/.lock")) {
|
||||
die("Locked! Delete .lock file first");
|
||||
}
|
||||
}
|
||||
|
||||
public function setLock($path)
|
||||
{
|
||||
file_put_contents("$path/.lock", "Lock at: " . date('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ require ROOT_PATH . 'nexus/Install/install_update_start.php';
|
||||
|
||||
$isPost = $_SERVER['REQUEST_METHOD'] == 'POST';
|
||||
$install = new \Nexus\Install\Install();
|
||||
$install->checkLock(__DIR__);
|
||||
$currentStep = $install->currentStep();
|
||||
$maxStep = $install->maxStep();
|
||||
if (!$install->canAccessStep($currentStep)) {
|
||||
@@ -191,6 +192,7 @@ if (!empty($error) || (isset($mysqlInfo) && !$mysqlInfo['match'])) {
|
||||
echo '<div class="mb-6">For questions, consult the installation log at: <code>' . $install->getLogFile() . '</code></div>';
|
||||
echo '<div class="text-red-500">For security reasons, please delete the following directories</div>';
|
||||
echo '<div class="text-red-500"><code>' . $install->getInsallDirectory() . '</code></div>';
|
||||
$install->setLock(__DIR__);
|
||||
}
|
||||
echo'</div>';
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ require ROOT_PATH . 'nexus/Install/install_update_start.php';
|
||||
|
||||
$isPost = $_SERVER['REQUEST_METHOD'] == 'POST';
|
||||
$update = new \Nexus\Install\Update();
|
||||
$update->checkLock(__DIR__);
|
||||
$currentStep = $update->currentStep();
|
||||
$maxStep = $update->maxStep();
|
||||
if (!$update->canAccessStep($currentStep)) {
|
||||
@@ -227,6 +228,7 @@ if (!empty($error) || (isset($mysqlInfo) && !$mysqlInfo['match'])) {
|
||||
echo '<div class="mb-6">For questions, consult the upgrade log at: <code>' . $update->getLogFile() . '</code></div>';
|
||||
echo '<div class="text-red-500">For security reasons, please delete the following directories</div>';
|
||||
echo '<div class="text-red-500"><code>' . $update->getUpdateDirectory() . '</code></div>';
|
||||
$update->setLock(__DIR__);
|
||||
}
|
||||
echo'</div>';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user