![]() |
Bearsampp 2025.8.29
|
Public Member Functions | |
__construct ($args) | |
processWindow ($window, $id, $ctrl, $param1, $param2) |
Data Fields | |
const | GAUGE_OTHERS = 19 |
const | GAUGE_SERVICES = 5 |
Private Member Functions | |
changePath () | |
checkApacheServiceWithTimeout ($service) | |
checkBinsRegKey () | |
checkBrowser () | |
checkLaunchStartup () | |
checkMySQLServiceWithTimeout ($service, $bin) | |
checkPath () | |
checkPathRegKey () | |
checkSystemPathRegKey () | |
cleanOldBehaviors () | |
cleanTmpFolders () | |
createSslCrts () | |
installServices () | |
killOldInstances () | |
refreshAliases () | |
refreshGitRepos () | |
refreshHostname () | |
refreshVhosts () | |
rotationLogs () | |
savePath () | |
scanFolders () | |
sysInfos () | |
updateConfig () | |
writeLog ($log) |
Private Attributes | |
$error | |
$filesToScan | |
$restart | |
$rootPath | |
$splash | |
$startTime |
Class ActionStartup Handles the startup process of the Bearsampp application, including initializing services, cleaning temporary files, refreshing configurations, and more.
Definition at line 16 of file class.action.startup.php.
__construct | ( | $args | ) |
ActionStartup constructor. Initializes the startup process, including the splash screen and various configurations.
array | $args | Command line arguments. |
Definition at line 35 of file class.action.startup.php.
References $bearsamppBins, $bearsamppCore, $bearsamppLang, $bearsamppRoot, APP_TITLE, Util\getMicrotime(), Lang\STARTUP, Lang\STARTUP_STARTING_TEXT, and writeLog().
|
private |
Changes the application path and logs the number of files and occurrences changed.
Definition at line 664 of file class.action.startup.php.
References $bearsamppLang, $result, Util\changePath(), Lang\STARTUP_CHANGE_PATH_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Specialized method to check Apache service with timeout protection. Apache service checks can sometimes hang, so this method provides a safer way to check.
object | $service | The Apache service object |
Definition at line 1129 of file class.action.startup.php.
References $startTime, and Util\logTrace().
Referenced by installServices().
|
private |
Checks and updates the application bins registry key. If the current registry key does not match the generated key, it updates the registry key. Logs the current and generated registry keys. Sets an error message if the registry key update fails. Sets a restart flag if the registry key is updated.
Definition at line 723 of file class.action.startup.php.
References $bearsamppLang, Registry\APP_BINS_REG_ENTRY, Util\getAppBinsRegKey(), Util\setAppBinsRegKey(), Lang\STARTUP_REGISTRY_ERROR_TEXT, Lang\STARTUP_REGISTRY_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Checks and sets the default browser configuration.
Definition at line 578 of file class.action.startup.php.
References $bearsamppConfig, $bearsamppLang, Config\CFG_BROWSER, Vbs\getDefaultBrowser(), Lang\STARTUP_CHECK_BROWSER_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Checks and sets the launch startup configuration.
Definition at line 561 of file class.action.startup.php.
References $bearsamppConfig, Util\disableLaunchStartup(), Util\enableLaunchStartup(), and writeLog().
Referenced by processWindow().
|
private |
Specialized method to check MySQL service with timeout protection. MySQL service checks can sometimes hang, so this method provides a safer way to check.
object | $service | The MySQL service object |
object | $bin | The MySQL bin object |
Definition at line 1178 of file class.action.startup.php.
References Util\logTrace().
Referenced by installServices().
|
private |
Checks the application path and logs the last path content.
Definition at line 637 of file class.action.startup.php.
References $bearsamppCore, $bearsamppLang, Lang\STARTUP_CHECK_PATH_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Checks and updates the application path registry key.
Definition at line 690 of file class.action.startup.php.
References $bearsamppLang, $bearsamppRoot, Registry\APP_PATH_REG_ENTRY, Util\formatWindowsPath(), Util\getAppPathRegKey(), Util\setAppPathRegKey(), Lang\STARTUP_REGISTRY_ERROR_TEXT, Lang\STARTUP_REGISTRY_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Checks and updates the system PATH registry key. Ensures the application bins registry entry is at the beginning of the system PATH. Logs the current and new system PATH. Sets an error message if the system PATH update fails. Sets a restart flag if the system PATH is updated.
Definition at line 756 of file class.action.startup.php.
References $bearsamppLang, Registry\APP_BINS_REG_ENTRY, Util\getSysPathRegKey(), Util\setSysPathRegKey(), Lang\STARTUP_REGISTRY_ERROR_TEXT, Lang\STARTUP_REGISTRY_TEXT, Registry\SYSPATH_REG_ENTRY, and writeLog().
Referenced by processWindow().
|
private |
Cleans old behaviors by removing outdated registry entries.
Definition at line 492 of file class.action.startup.php.
References $bearsamppLang, APP_TITLE, Registry\HKEY_LOCAL_MACHINE, Lang\STARTUP_CLEAN_OLD_BEHAVIORS_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Cleans temporary folders by removing unnecessary files.
Definition at line 477 of file class.action.startup.php.
References $bearsamppCore, $bearsamppLang, $bearsamppRoot, Util\clearFolder(), Lang\STARTUP_CLEAN_TMP_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Creates SSL certificates if they do not already exist. Logs the creation process.
Definition at line 812 of file class.action.startup.php.
References $bearsamppLang, and Lang\STARTUP_GEN_SSL_CRT_TEXT.
Referenced by processWindow().
|
private |
Installs and starts services for the application. Checks if services are already installed and updates them if necessary. Logs the installation process and any errors encountered.
Definition at line 829 of file class.action.startup.php.
References $bearsamppBins, $bearsamppLang, $bearsamppRoot, $port, checkApacheServiceWithTimeout(), checkMySQLServiceWithTimeout(), BinApache\CMD_SYNTAX_CHECK, BinMariadb\CMD_SYNTAX_CHECK, BinMysql\CMD_SYNTAX_CHECK, Util\getMicrotime(), Util\isPortInUse(), Win32Ps\killBins(), Util\logTrace(), BinApache\SERVICE_NAME, BinMailpit\SERVICE_NAME, BinMariadb\SERVICE_NAME, BinMemcached\SERVICE_NAME, BinMysql\SERVICE_NAME, BinPostgresql\SERVICE_NAME, BinXlight\SERVICE_NAME, Lang\STARTUP_CHECK_SERVICE_TEXT, Lang\STARTUP_INSTALL_SERVICE_TEXT, Lang\STARTUP_SERVICE_CREATE_ERROR, Lang\STARTUP_SERVICE_ERROR, Lang\STARTUP_SERVICE_PORT_ERROR, Lang\STARTUP_SERVICE_START_ERROR, Lang\STARTUP_SERVICE_SYNTAX_ERROR, Lang\STARTUP_START_SERVICE_TEXT, Win32Service\VBS_PATH_NAME, and writeLog().
Referenced by processWindow().
|
private |
Kills old instances of Bearsampp processes.
Definition at line 512 of file class.action.startup.php.
References $bearsamppLang, $proc, Win32Ps\EXECUTABLE_PATH, Util\formatUnixPath(), Win32Ps\killBins(), Win32Ps\PROCESS_ID, Lang\STARTUP_KILL_OLD_PROCS_TEXT, and writeLog().
Referenced by processWindow().
processWindow | ( | $window, | |
$id, | |||
$ctrl, | |||
$param1, | |||
$param2 ) |
Processes the main window events during startup.
mixed | $window | The window handle. |
int | $id | The event ID. |
mixed | $ctrl | The control that triggered the event. |
mixed | $param1 | Additional parameter 1. |
mixed | $param2 | Additional parameter 2. |
Definition at line 73 of file class.action.startup.php.
References $bearsamppBins, $bearsamppCore, $bearsamppLang, $bearsamppRoot, $proc, APP_TITLE, changePath(), checkBinsRegKey(), checkBrowser(), checkLaunchStartup(), checkPath(), checkPathRegKey(), checkSystemPathRegKey(), cleanOldBehaviors(), cleanTmpFolders(), createSslCrts(), Lang\DISABLED, Win32Ps\EXECUTABLE_PATH, exit, Util\formatUnixPath(), Win32Ps\getCurrentPid(), Util\getMicrotime(), installServices(), killOldInstances(), Util\logTrace(), Win32Ps\PROCESS_ID, refreshAliases(), refreshGitRepos(), refreshHostname(), refreshVhosts(), ActionExec\RESTART, rotationLogs(), savePath(), scanFolders(), Util\startLoading(), Lang\STARTUP_ERROR_TITLE, Lang\STARTUP_PREPARE_RESTART_TEXT, sysInfos(), ActionQuit\terminatePhpProcesses(), updateConfig(), and writeLog().
|
private |
Refreshes the aliases in the Apache configuration.
Definition at line 609 of file class.action.startup.php.
References $bearsamppBins, $bearsamppConfig, $bearsamppLang, Lang\STARTUP_REFRESH_ALIAS_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Refreshes Git repositories if the scan on startup is enabled. Logs the number of repositories found.
Definition at line 1109 of file class.action.startup.php.
References $bearsamppLang, Lang\STARTUP_REFRESH_GIT_REPOS_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Refreshes the hostname in the configuration.
Definition at line 547 of file class.action.startup.php.
References $bearsamppConfig, $bearsamppLang, Config\CFG_HOSTNAME, Lang\STARTUP_REFRESH_HOSTNAME_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Refreshes the virtual hosts in the Apache configuration.
Definition at line 623 of file class.action.startup.php.
References $bearsamppBins, $bearsamppConfig, $bearsamppLang, Lang\STARTUP_REFRESH_VHOSTS_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Rotates the logs by archiving old logs and purging old archives. Enhanced with file lock checking to prevent permission denied errors.
Definition at line 263 of file class.action.startup.php.
References $bearsamppBins, $bearsamppConfig, $bearsamppCore, $bearsamppLang, $bearsamppRoot, Util\deleteFolder(), Util\logTrace(), and Lang\STARTUP_ROTATION_LOGS_TEXT.
Referenced by processWindow().
|
private |
Saves the current application path.
Definition at line 679 of file class.action.startup.php.
References $bearsamppCore, and writeLog().
Referenced by processWindow().
|
private |
Scans folders and logs the number of files to scan.
Definition at line 650 of file class.action.startup.php.
References $bearsamppLang, Util\getFilesToScan(), Lang\STARTUP_SCAN_FOLDERS_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Logs system information.
Definition at line 595 of file class.action.startup.php.
References $bearsamppLang, Batch\getOsInfo(), Lang\STARTUP_SYS_INFOS, and writeLog().
Referenced by processWindow().
|
private |
Updates the configuration for bins, tools, and apps. Logs the update process.
Definition at line 795 of file class.action.startup.php.
References $bearsamppBins, $bearsamppLang, Lang\STARTUP_UPDATE_CONFIG_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Writes a log message to the startup log file.
string | $log | The log message to write. |
Definition at line 1223 of file class.action.startup.php.
References $bearsamppRoot, and Util\logDebug().
Referenced by __construct(), changePath(), checkBinsRegKey(), checkBrowser(), checkLaunchStartup(), checkPath(), checkPathRegKey(), checkSystemPathRegKey(), cleanOldBehaviors(), cleanTmpFolders(), installServices(), killOldInstances(), processWindow(), refreshAliases(), refreshGitRepos(), refreshHostname(), refreshVhosts(), savePath(), scanFolders(), sysInfos(), and updateConfig().
|
private |
Definition at line 21 of file class.action.startup.php.
|
private |
Definition at line 24 of file class.action.startup.php.
|
private |
Definition at line 19 of file class.action.startup.php.
|
private |
Definition at line 23 of file class.action.startup.php.
|
private |
Definition at line 18 of file class.action.startup.php.
|
private |
Definition at line 20 of file class.action.startup.php.
Referenced by checkApacheServiceWithTimeout().
const GAUGE_OTHERS = 19 |
Definition at line 27 of file class.action.startup.php.
const GAUGE_SERVICES = 5 |
Definition at line 26 of file class.action.startup.php.