Bearsampp 2025.8.29
Loading...
Searching...
No Matches
class.action.rebuildIni.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
18{
28 public function __construct($args)
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 }
78}
global $bearsamppRoot
global $bearsamppCore
static triggerReload($args=null)
static logTrace($data, $file=null)