Bearsampp
2026.9.23
Toggle main menu visibility
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
19
class
ActionRebuildini
20
{
31
public
function
__construct
($args)
32
{
33
global
$bearsamppRoot
,
$bearsamppCore
;
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
]
50
ImageList=sprites.dat
51
ServiceCheckInterval=1
52
TrayIconAllRunning=16
53
TrayIconSomeRunning=17
54
TrayIconNoneRunning=18
55
ID={bearsampp}
56
AboutHeader=
Bearsampp
57
AboutVersion=Version @RELEASE_VERSION@
58
59
[Services]
60
Name: bearsamppmailpit
61
Name: bearsamppmemcached
62
Name: bearsamppapache
63
Name: bearsamppmysql
64
Name: bearsamppmariadb
65
Name: bearsampppostgresql
66
Name: bearsamppxlight
67
68
[Messages]
69
AllRunningHint=All services running
70
SomeRunningHint=%n of %t services running
71
NoneRunningHint=None of %t services running
72
73
[StartupAction]
74
Action
: run; FileName:
"%AeTrayMenuPath%core/libs/php/php-win.exe"
; Parameters:
"root.php startup"
; WorkingDir:
"%AeTrayMenuPath%core"
; Flags: waituntilterminated
75
Action
: run; FileName:
"%AeTrayMenuPath%core/libs/php/php-win.exe"
; Parameters:
"root.php reload"
; WorkingDir:
"%AeTrayMenuPath%core"
; Flags: waituntilterminated
76
Action
: resetservices
77
Action
: readconfig
78
Action
: run; FileName:
"%AeTrayMenuPath%core/libs/php/php-win.exe"
; Parameters:
"root.php checkVersion"
; WorkingDir:
"%AeTrayMenuPath%core"
; Flags: waituntilterminated
79
Action
: run; FileName:
"%AeTrayMenuPath%core/libs/php/php-win.exe"
; Parameters:
"root.php exec"
; WorkingDir:
"%AeTrayMenuPath%core"
80
EOD;
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
}
$bearsamppRoot
global $bearsamppRoot
Definition
ajax.apache.php:16
$bearsamppCore
global $bearsamppCore
Definition
ajax.latestversion.php:24
Action
Definition
class.action.php:14
ActionRebuildini
Definition
class.action.rebuildIni.php:20
ActionRebuildini\__construct
__construct($args)
Definition
class.action.rebuildIni.php:31
Config
Definition
class.config.php:18
Log\trace
static trace($data, $file=null)
Definition
class.log.php:715
Path\getIniFilePath
static getIniFilePath($aetrayPath=false)
Definition
class.path.php:571
TplAppReload\triggerReload
static triggerReload($args=null)
Definition
class.tpl.app.reload.php:66
Bearsampp
sandbox
core
classes
actions
class.action.rebuildIni.php
Generated by
1.17.0