update istall
This commit is contained in:
parent
197c4b56f7
commit
88ba3bb786
1
install.lock
Normal file
1
install.lock
Normal file
@ -0,0 +1 @@
|
||||
2026-04-01 09:15:21
|
||||
@ -5,7 +5,7 @@ if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
if (file_exists(__DIR__ . '/.installed')) {
|
||||
if (file_exists(__DIR__ . '/.installed') || file_exists(__DIR__ . '/install.lock')) {
|
||||
die('Installation already completed. To reinstall, delete the .installed file.');
|
||||
}
|
||||
|
||||
@ -74,6 +74,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
} elseif ($step === 5) {
|
||||
file_put_contents(__DIR__ . '/.installed', date('Y-m-d H:i:s'));
|
||||
file_put_contents(__DIR__ . '/install.lock', date('Y-m-d H:i:s'));
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -6,7 +6,24 @@ if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||
}
|
||||
$publicPages = ["login.php", "logout.php", "install.php", "display.php", "ticket.php"];
|
||||
$currentPage = basename((string) ($_SERVER["PHP_SELF"] ?? "index.php"));
|
||||
if (!file_exists(__DIR__ . "/.installed") && $currentPage !== "install.php") {
|
||||
$isInstalled = file_exists(__DIR__ . "/.installed") || file_exists(__DIR__ . "/install.lock");
|
||||
if (!$isInstalled) {
|
||||
try {
|
||||
if (file_exists(__DIR__ . '/db/config.php')) {
|
||||
require_once __DIR__ . '/db/config.php';
|
||||
if (function_exists('db')) {
|
||||
$pdo = db();
|
||||
$stmt = @$pdo->query("SELECT COUNT(*) FROM users");
|
||||
if ($stmt !== false && ((int)$stmt->fetchColumn()) > 0) {
|
||||
$isInstalled = true;
|
||||
@file_put_contents(__DIR__ . '/install.lock', date('Y-m-d H:i:s'));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {}
|
||||
}
|
||||
|
||||
if (!$isInstalled && $currentPage !== "install.php") {
|
||||
header("Location: install.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user