Bearsampp 2026.9.23
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
20{
31 public function __construct($args)
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 }
91}
global $bearsamppRoot
global $bearsamppCore
static trace($data, $file=null)
static getIniFilePath($aetrayPath=false)
static triggerReload($args=null)