Add locking

This commit is contained in:
John Alanbrook 2022-11-04 08:44:50 +00:00
parent 5383f537e2
commit adaf160aaa

View file

@ -1,6 +1,30 @@
<?php
require "parsedown.php";
$tryuri = ltrim("$_SERVER[REQUEST_URI]", '/');
$tryuri = strtok($tryuri, "?");
$lockscn = $tryuri;
if (file_exists("$lockscn.lock" ))
return;
while ($lockscn != "") {
$files = scandir($lockscn);
if (!$files)
goto CONT;
for ($i = 2; $i < count($files); $i++) {
if ($files[$i] == "lock") {
return;
}
}
CONT:
$lockscn = substr($lockscn, 0, strrpos($lockscn, '/'));
}
if (file_exists("site.json")) {
$site = json_decode(file_get_contents("site.json"), true);
@ -10,8 +34,7 @@ if (preg_match('/\.(?:jpg|png|css|ico|scss|js|ttf|woff|txt)/', $_SERVER["REQUEST
return false;
}
$tryuri = ltrim("$_SERVER[REQUEST_URI]", '/');
$tryuri = strtok($tryuri, "?");
load_page($tryuri);