Bearsampp 2025.8.29
Loading...
Searching...
No Matches
ActionExec Class Reference

Public Member Functions

 __construct ($args)

Data Fields

const QUIT = 'quit'
const RESTART = 'restart'

Detailed Description

Class ActionExec

This class handles the execution of specific actions based on the content of a file. The actions include quitting the application or reloading it. The actions are read from a file whose path is provided by the global $bearsamppCore object.

Definition at line 18 of file class.action.exec.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( $args)

ActionExec constructor.

This constructor reads the action from a file specified by $bearsamppCore->getExec(). If the action is 'quit', it calls Batch\exitApp(). If the action is 'restart', it calls Batch\restartApp(). After executing the action, it deletes the action file.

Parameters
array$argsArguments passed to the constructor (not used in the current implementation).

Definition at line 39 of file class.action.exec.php.

40 {
41 global $bearsamppCore;
42
43 Util::logTrace('ActionExec constructor called');
44
45 $execFile = $bearsamppCore->getExec();
46 Util::logTrace('Checking for exec file: ' . $execFile);
47
48 if (file_exists($execFile)) {
49 Util::logTrace('Exec file exists');
50
51 $action = file_get_contents($execFile);
52 Util::logTrace('Action read from exec file: "' . $action . '"');
53
54 if ($action == self::QUIT) {
55 Util::logTrace('Executing quit action');
57 } elseif ($action == self::RESTART) {
58 Util::logTrace('Executing restart action');
60 } else {
61 Util::logTrace('Unknown action: "' . $action . '"');
62 }
63
64 Util::logTrace('Deleting exec file');
65 $unlinkResult = @unlink($execFile);
66 Util::logTrace('Unlink result: ' . ($unlinkResult ? 'success' : 'failed'));
67 } else {
68 Util::logTrace('Exec file does not exist: ' . $execFile);
69 }
70 }
global $bearsamppCore
static exitApp($restart=false)
static restartApp()
static logTrace($data, $file=null)

References $bearsamppCore, Batch\exitApp(), Util\logTrace(), and Batch\restartApp().

Field Documentation

◆ QUIT

const QUIT = 'quit'

Constant representing the 'quit' action.

Definition at line 23 of file class.action.exec.php.

◆ RESTART

const RESTART = 'restart'

Constant representing the 'reload' action.

Definition at line 28 of file class.action.exec.php.

Referenced by ActionManualRestart\__construct(), ActionStartup\processWindow(), and ActionSwitchVersion\processWindow().


The documentation for this class was generated from the following file: