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