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

Public Member Functions

 __construct ($args)

Detailed Description

Class ActionRebuildini

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 19 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 31 of file class.action.rebuildIni.php.

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

References $bearsamppCore, $bearsamppRoot, Path\getIniFilePath(), Log\trace(), and TplAppReload\triggerReload().

Here is the call graph for this function:

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