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