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

Public Member Functions

 __construct ($args)

Detailed Description

Handles the action of rebuilding the bearsampp.ini file within the application.

This class is responsible for deleting the existing bearsampp.ini file and creating a new one with the specified configuration content.

Definition at line 17 of file class.action.rebuildIni.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( $args)

Constructor for the ActionRebuildini class.

Upon instantiation, it deletes the existing bearsampp.ini file and creates a new one with the specified configuration content.

Parameters
array$argsArguments that might be used for further extension of constructor functionality.
Exceptions
ExceptionIf the bearsampp.ini file cannot be written.

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

29 {
31
32 // Step 0: Delete the existing bearsampp.ini file
33 $iniFilePath = $bearsamppRoot->getIniFilePath();
34
35 if (file_exists($iniFilePath)) {
36 unlink($iniFilePath);
37 }
38
39 // Process and update the bearsampp.ini file
40 // Step 1: Prepare the configuration content
41 $configContent = <<<EOD
42[Config]
43ImageList=sprites.dat
44ServiceCheckInterval=1
45TrayIconAllRunning=16
46TrayIconSomeRunning=17
47TrayIconNoneRunning=18
48ID={Bearsampp}
49AboutHeader=Bearsampp
50AboutVersion=Version @RELEASE_VERSION@
51
52[Services]
53Name: bearsamppapache
54
55[Messages]
56AllRunningHint=All services running
57SomeRunningHint=%n of %t services running
58NoneRunningHint=None of %t services running
59
60[StartupAction]
61Action: run; FileName: "%AeTrayMenuPath%core/libs/php/php-win.exe"; Parameters: "root.php startup"; WorkingDir: "%AeTrayMenuPath%core"; Flags: waituntilterminated
62Action: run; FileName: "%AeTrayMenuPath%core/libs/php/php-win.exe"; Parameters: "root.php reload"; WorkingDir: "%AeTrayMenuPath%core"; Flags: waituntilterminated
63Action: resetservices
64Action: readconfig
65Action: run; FileName: "%AeTrayMenuPath%core/libs/php/php-win.exe"; Parameters: "root.php checkVersion"; WorkingDir: "%AeTrayMenuPath%core"; Flags: waituntilterminated
66Action: run; FileName: "%AeTrayMenuPath%core/libs/php/php-win.exe"; Parameters: "root.php exec"; WorkingDir: "%AeTrayMenuPath%core"
67EOD;
68
69 // Step 2: Write to the file
70 if (file_put_contents($iniFilePath, $configContent) === false) {
71 throw new Exception("Failed to write to bearsampp.ini file.");
72 }
73
74 Util::logTrace('Calling triggerReload...');
75 $reloadAction = TplAppReload::triggerReload($args);
76 Util::logTrace('Reload action: ' . $reloadAction);
77 }
global $bearsamppRoot
global $bearsamppCore
static triggerReload($args=null)
static logTrace($data, $file=null)

References $bearsamppCore, $bearsamppRoot, Util\logTrace(), and TplAppReload\triggerReload().


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