Bearsampp 2025.8.29
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
19{
23 const QUIT = 'quit';
24
28 const RESTART = 'restart';
29
39 public function __construct($args)
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 }
71}
global $bearsamppCore
static exitApp($restart=false)
static restartApp()
static logTrace($data, $file=null)