Changed locking strategy.
This commit is contained in:
parent
dfa49d208c
commit
33865ad9f4
@ -9,8 +9,6 @@
|
||||
$FILEMANAGER = "spacefm";
|
||||
$LOCKPASSWORD = "1234";
|
||||
$TMPFOLDERSIZE = 8000; // tmp folder size check for cleanup if above 8GB used.
|
||||
$UNLOCKTIME = 80; // Every ~3 sec this ticks down
|
||||
// Ex: 3*60 == 180 sec or 3 minutes
|
||||
// NOTE: Split folders with ::::
|
||||
$LOCKEDFOLDERS = "./dirLockCheck/";
|
||||
|
||||
|
@ -6,14 +6,14 @@
|
||||
$LOCKS = explode("::::", $LOCKEDFOLDERS);
|
||||
$size = sizeof($LOCKS);
|
||||
|
||||
if (isset($_SESSION["unlockTime"]) && $_SESSION["unlockTime"] > 0) {
|
||||
if (isset($_SESSION["unlockState"]) && $_SESSION["unlockState"] == true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for ($i = 0; $i < $size; $i++) {
|
||||
if (strpos($NEWPATH, $LOCKS[$i]) !== false) {
|
||||
if ($PASSWD === $LOCKPASSWORD) {
|
||||
$_SESSION["unlockTime"] = $UNLOCKTIME;
|
||||
$_SESSION["unlockState"] = true;
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@ -27,13 +27,13 @@
|
||||
session_start();
|
||||
include 'serverMessenger.php';
|
||||
|
||||
if (isset($_SESSION["unlockTime"]) && $_SESSION["unlockTime"] > 0) {
|
||||
$_SESSION["unlockTime"] = -1;
|
||||
if (isset($_SESSION["unlockState"]) && $_SESSION["unlockState"] == true) {
|
||||
$_SESSION["unlockState"] = false;
|
||||
$message = "Server: [Success] --> Folders unlocked!";
|
||||
serverMessage("success", $message);
|
||||
} else {
|
||||
$message = "Server: [Warning] --> Folders aren't unlocked!"
|
||||
. "\n" . $_SESSION["unlockTime"];
|
||||
. "\n" . $_SESSION["unlockState"];
|
||||
serverMessage("warning", $message);
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,6 @@
|
||||
$_SESSION["refreshState"] = "none";
|
||||
}
|
||||
|
||||
if (isset($_SESSION["unlockTime"]) && $_SESSION["unlockTime"] >= 0) {
|
||||
$_SESSION["unlockTime"] -= 1;
|
||||
}
|
||||
|
||||
header('Content-Type: text/event-stream');
|
||||
header('Cache-Control: no-cache');
|
||||
echo "data:" . $_SESSION["refreshState"] . "\n\n";
|
||||
|
Loading…
Reference in New Issue
Block a user