Bearsampp
2026.7.11
Toggle main menu visibility
Loading...
Searching...
No Matches
class.action.exec.php
Go to the documentation of this file.
1
<?php
2
/*
3
*
4
* * Copyright (c) 2022-2025 Bearsampp
5
* * License: GNU General Public License version 3 or later; see LICENSE.txt
6
* * Website: https://bearsampp.com
7
* * Github: https://github.com/Bearsampp
8
*
9
*/
10
18
class
ActionExec
19
{
23
const
QUIT
=
'quit'
;
24
28
const
RESTART
=
'restart'
;
29
39
public
function
__construct
($args)
40
{
41
global
$bearsamppCore
;
42
43
Log::trace
(
'ActionExec constructor called'
);
44
45
$execFile =
$bearsamppCore
->getExec();
46
Log::trace
(
'Checking for exec file: '
. $execFile);
47
48
if
(file_exists($execFile)) {
49
Log::trace
(
'Exec file exists'
);
50
51
$action = file_get_contents($execFile);
52
Log::trace
(
'Action read from exec file: "'
. $action .
'"'
);
53
54
if
($action == self::QUIT) {
55
Log::trace
(
'Executing quit action'
);
56
Batch::exitApp
();
57
} elseif ($action == self::RESTART) {
58
Log::trace
(
'Executing restart action'
);
59
Batch::restartApp
();
60
}
else
{
61
Log::trace
(
'Unknown action: "'
. $action .
'"'
);
62
}
63
64
// Do NOT delete the exec file yet if it's a restart,
65
// as we need the next instance to know it's a restart.
66
// ActionStartup will handle the unlinking.
67
if
($action != self::RESTART) {
68
Log::trace
(
'Deleting exec file'
);
69
$unlinkResult = @unlink($execFile);
70
Log::trace
(
'Unlink result: '
. ($unlinkResult ?
'success'
:
'failed'
));
71
}
72
}
else
{
73
Log::trace
(
'Exec file does not exist: '
. $execFile);
74
}
75
}
76
}
77
$bearsamppCore
global $bearsamppCore
Definition
ajax.latestversion.php:24
ActionExec
Definition
class.action.exec.php:19
ActionExec\QUIT
const QUIT
Definition
class.action.exec.php:23
ActionExec\__construct
__construct($args)
Definition
class.action.exec.php:39
ActionExec\RESTART
const RESTART
Definition
class.action.exec.php:28
Batch\exitApp
static exitApp($restart=false)
Definition
class.batch.php:120
Batch\restartApp
static restartApp()
Definition
class.batch.php:142
Log\trace
static trace($data, $file=null)
Definition
class.log.php:605
sandbox
core
classes
actions
class.action.exec.php
Generated by
1.17.0