2024.8.23
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 16 of file class.action.rebuildIni.php.

Constructor & Destructor Documentation

◆ __construct()

ActionRebuildini::__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 27 of file class.action.rebuildIni.php.

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

References $bearsamppCore, $bearsamppRoot, and TplAppReload\getActionReload().


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