2024.8.23
Loading...
Searching...
No Matches
class.action.reload.php
Go to the documentation of this file.
1
<?php
2
/*
3
* Copyright (c) 2021-2024 Bearsampp
4
* License: GNU General Public License version 3 or later; see LICENSE.txt
5
* Author: Bear
6
* Website: https://bearsampp.com
7
* Github: https://github.com/Bearsampp
8
*/
9
10
/**
11
* Class ActionReload
12
*
13
* This class handles the reloading of various configurations and settings for the Bearsampp application.
14
* It performs operations such as refreshing the hostname, updating startup settings, checking and updating
15
* the browser configuration, processing configuration files, and rebuilding certain cached contents.
16
*/
17
class
ActionReload
18
{
19
/**
20
* Constructs an ActionReload object and performs various refresh operations.
21
*
22
* @param array $args The arguments passed to the constructor.
23
*
24
* @global Root $bearsamppRoot The root object of the Bearsampp application.
25
* @global Core $bearsamppCore The core object of the Bearsampp application.
26
* @global Config $bearsamppConfig The configuration object of the Bearsampp application.
27
* @global Bins $bearsamppBins The bins object containing various binaries used by the Bearsampp application.
28
* @global Homepage $bearsamppHomepage The homepage object for managing homepage-related settings and content.
29
*/
30
public
function
__construct
($args)
31
{
32
global
$bearsamppRoot
,
$bearsamppCore
,
$bearsamppConfig
,
$bearsamppBins
,
$bearsamppHomepage
;
33
34
// If the executable file exists, return early.
35
if
(file_exists(
$bearsamppCore
->getExec())) {
36
return
;
37
}
38
39
// Start loading process
40
Util::startLoading
();
41
42
// Refresh hostname in the configuration
43
$bearsamppConfig
->replace(
Config::CFG_HOSTNAME
, gethostname());
44
45
// Refresh launch startup setting in the configuration
46
$bearsamppConfig
->replace(
Config::CFG_LAUNCH_STARTUP
,
Util::isLaunchStartup
() ?
Config::ENABLED
:
Config::DISABLED
);
47
48
// Check and update the browser setting in the configuration
49
$currentBrowser =
$bearsamppConfig
->getBrowser();
50
if
(empty($currentBrowser) || !file_exists($currentBrowser)) {
51
$bearsamppConfig
->replace(
Config::CFG_BROWSER
,
Vbs::getDefaultBrowser
());
52
}
53
54
// Process and update the bearsampp.ini file
55
file_put_contents(
$bearsamppRoot
->getIniFilePath(),
Util::utf8ToCp1252
(
TplApp::process
()));
56
57
// Process and update the ConsoleZ configuration
58
TplConsoleZ::process
();
59
60
// Refresh PEAR version cache file
61
$bearsamppBins
->getPhp()->getPearVersion();
62
63
// Rebuild alias homepage content
64
$bearsamppHomepage
->refreshAliasContent();
65
66
// Rebuild _commons.js content
67
$bearsamppHomepage
->refreshCommonsJsContent();
68
}
69
}
$bearsamppBins
global $bearsamppBins
Definition
ajax.apache.php:16
$bearsamppRoot
global $bearsamppRoot
Definition
ajax.apache.php:16
$bearsamppCore
global $bearsamppCore
Definition
ajax.latestversion.php:24
ActionReload
Definition
class.action.reload.php:18
ActionReload\__construct
__construct($args)
Definition
class.action.reload.php:30
Config\DISABLED
const DISABLED
Definition
class.config.php:33
Config\ENABLED
const ENABLED
Definition
class.config.php:32
Config\CFG_LAUNCH_STARTUP
const CFG_LAUNCH_STARTUP
Definition
class.config.php:30
Config\CFG_HOSTNAME
const CFG_HOSTNAME
Definition
class.config.php:27
Config\CFG_BROWSER
const CFG_BROWSER
Definition
class.config.php:28
TplApp\process
static process()
Definition
class.tpl.app.php:43
TplConsoleZ\process
static process()
Definition
class.tpl.consolez.php:47
Util\startLoading
static startLoading()
Definition
class.util.php:947
Util\utf8ToCp1252
static utf8ToCp1252($data)
Definition
class.util.php:927
Util\isLaunchStartup
static isLaunchStartup()
Definition
class.util.php:645
Vbs\getDefaultBrowser
static getDefaultBrowser()
Definition
class.vbs.php:80
$bearsamppConfig
global $bearsamppConfig
Definition
homepage.php:26
$bearsamppHomepage
global $bearsamppHomepage
Definition
homepage.php:26
Bearsampp-development
sandbox
core
classes
actions
class.action.reload.php
Generated by
1.11.0