Bearsampp
2026.7.28
Toggle main menu visibility
Loading...
Searching...
No Matches
ajax.reload.status.php
Go to the documentation of this file.
1
<?php
2
/*
3
* Copyright (c) 2025 Bearsampp
4
* License: GNU General Public License version 3 or later; see LICENSE.txt
5
* Website: https://bearsampp.com
6
* Github: https://github.com/Bearsampp
7
*/
8
19
20
header(
'Content-Type: application/json'
);
21
22
$response
= array();
23
24
try
{
25
$reloadStatusFile =
Path::getLogsPath
() .
'/reload-status.json'
;
26
27
if
(file_exists($reloadStatusFile)) {
28
$statusContent = file_get_contents($reloadStatusFile);
29
$status = json_decode($statusContent,
true
);
30
31
if
($status !==
null
) {
32
$response
= array(
33
'completed'
=>
true
,
34
'status'
=> $status
35
);
36
37
Log::debug
(
'Reload status retrieved: '
. json_encode($status));
38
} elseif (json_last_error() !== JSON_ERROR_NONE) {
39
// Invalid JSON detected (likely from concurrent partial write)
40
Log::warning
(
'Reload status file has invalid JSON: '
. json_last_error_msg());
41
$response
= array(
42
'completed'
=>
false
,
43
'message'
=>
'Status file being updated'
44
);
45
}
else
{
46
$response
= array(
47
'completed'
=>
false
,
48
'message'
=>
'Reload in progress'
49
);
50
}
51
}
else
{
52
$response
= array(
53
'completed'
=>
false
,
54
'message'
=>
'Reload in progress'
55
);
56
}
57
}
catch
(Exception $e) {
58
Log::error
(
'Error checking reload status: '
. $e->getMessage());
59
$response
= array(
60
'error'
=>
'Failed to check reload status: '
. $e->getMessage(),
61
'completed'
=>
false
62
);
63
}
64
65
echo json_encode(
$response
);
66
exit
;
exit
exit
Definition
ajax.apply.moduleconfig.php:63
$response
$response
Definition
ajax.apply.moduleconfig.php:26
Log\debug
static debug($data, $file=null)
Definition
class.log.php:616
Log\warning
static warning($data, $file=null)
Definition
class.log.php:638
Log\error
static error($data, $file=null)
Definition
class.log.php:650
Path\getLogsPath
static getLogsPath($aetrayPath=false)
Definition
class.path.php:626
sandbox
core
resources
homepage
ajax
ajax.reload.status.php
Generated by
1.17.0