![]() |
Bearsampp 2026.5.5
|
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 () | |
| installServicesSequential ($bearsamppBins, $bearsamppLang) | |
| killOldInstances () | |
| prepareService ($sName, $service, $bearsamppBins, $bearsamppLang, $currentIndex=0, $totalCount=0) | |
| 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(), Log\info(), 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 725 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 1227 of file class.action.startup.php.
References $startTime, and Log\trace().
Referenced by prepareService().
|
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 784 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 614 of file class.action.startup.php.
References $bearsamppConfig, $bearsamppLang, Config\CFG_BROWSER, Win32Native\getDefaultBrowser(), Lang\STARTUP_CHECK_BROWSER_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Checks and sets the launch startup configuration.
Definition at line 597 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 1276 of file class.action.startup.php.
References Log\trace().
Referenced by prepareService().
|
private |
Checks the application path and logs the last path content.
Definition at line 673 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 751 of file class.action.startup.php.
References $bearsamppLang, $bearsamppRoot, Registry\APP_PATH_REG_ENTRY, UtilPath\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 817 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 528 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 498 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 873 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.
Uses optimized service checking and starting methods.
Definition at line 892 of file class.action.startup.php.
References $bearsamppBins, $bearsamppLang, $bearsamppRoot, installServicesSequential(), and Log\trace().
Referenced by processWindow().
|
private |
Service Installation Installs and starts services sequentially with proper progress tracking. Ensures exactly GAUGE_SERVICES (5) progress steps per service.
| object | $bearsamppBins | The bins object |
| object | $bearsamppLang | The language object |
Definition at line 922 of file class.action.startup.php.
References $bearsamppBins, $bearsamppLang, $error, Util\getMicrotime(), prepareService(), Lang\STARTUP_SERVICE_ERROR, Log\trace(), and writeLog().
Referenced by installServices().
|
private |
Kills old instances of Bearsampp processes.
Definition at line 548 of file class.action.startup.php.
References $bearsamppLang, $proc, Win32Ps\EXECUTABLE_PATH, UtilPath\formatUnixPath(), Win32Ps\killBins(), Win32Ps\PROCESS_ID, Lang\STARTUP_KILL_OLD_PROCS_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Prepares a service for startup (check, install if needed, but don't start yet)
| string | $sName | Service name |
| object | $service | Service object |
| object | $bearsamppBins | Bins object |
| object | $bearsamppLang | Language object |
| int | $currentIndex | Current service index |
| int | $totalCount | Total service count |
Definition at line 1052 of file class.action.startup.php.
References $bearsamppBins, $bearsamppLang, $port, checkApacheServiceWithTimeout(), checkMySQLServiceWithTimeout(), BinApache\CMD_SYNTAX_CHECK, BinMariadb\CMD_SYNTAX_CHECK, BinMysql\CMD_SYNTAX_CHECK, Util\getMicrotime(), Util\isPortInUse(), Win32Ps\killBins(), BinApache\SERVICE_NAME, BinMailpit\SERVICE_NAME, BinMariadb\SERVICE_NAME, BinMemcached\SERVICE_NAME, BinMysql\SERVICE_NAME, BinPostgresql\SERVICE_NAME, BinXlight\SERVICE_NAME, Lang\STARTUP_SERVICE_CREATE_ERROR, Lang\STARTUP_SERVICE_PORT_ERROR, Log\trace(), Win32Service\VBS_PATH_NAME, and writeLog().
Referenced by installServicesSequential().
| 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 77 of file class.action.startup.php.
References $bearsamppBins, $bearsamppConfig, $bearsamppCore, $bearsamppLang, $bearsamppRoot, $proc, APP_TITLE, changePath(), checkBinsRegKey(), checkBrowser(), checkLaunchStartup(), checkPath(), checkPathRegKey(), checkSystemPathRegKey(), cleanOldBehaviors(), cleanTmpFolders(), createSslCrts(), Lang\DISABLED, Win32Ps\EXECUTABLE_PATH, exit, UtilPath\formatUnixPath(), Util\getMicrotime(), installServices(), killOldInstances(), Win32Ps\PROCESS_ID, refreshAliases(), refreshGitRepos(), refreshHostname(), refreshVhosts(), ActionExec\RESTART, rotationLogs(), savePath(), scanFolders(), Util\startLoading(), Lang\STARTUP_ERROR_TITLE, Lang\STARTUP_PREPARE_RESTART_TEXT, sysInfos(), Log\trace(), updateConfig(), Config\VERBOSE_TRACE, and writeLog().
|
private |
Refreshes the aliases in the Apache configuration.
Definition at line 645 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 1207 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 583 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 659 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 284 of file class.action.startup.php.
References $bearsamppBins, $bearsamppConfig, $bearsamppCore, $bearsamppLang, $bearsamppRoot, Util\deleteFolder(), Lang\STARTUP_ROTATION_LOGS_TEXT, and Log\trace().
Referenced by processWindow().
|
private |
Saves the current application path.
Definition at line 740 of file class.action.startup.php.
References $bearsamppCore, and writeLog().
Referenced by processWindow().
|
private |
Scans folders and logs the number of files to scan. Performance optimization: Skips expensive file scan when path hasn't changed. This saves 3-8 seconds on typical startups (95% of cases).
Definition at line 688 of file class.action.startup.php.
References $bearsamppCore, $bearsamppLang, $rootPath, Log\debug(), Util\getFilesToScan(), Util\getMicrotime(), Lang\STARTUP_SCAN_FOLDERS_TEXT, Log\trace(), and writeLog().
Referenced by processWindow().
|
private |
Logs system information.
Definition at line 631 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 856 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 1321 of file class.action.startup.php.
References $bearsamppRoot, and Log\debug().
Referenced by __construct(), changePath(), checkBinsRegKey(), checkBrowser(), checkLaunchStartup(), checkPath(), checkPathRegKey(), checkSystemPathRegKey(), cleanOldBehaviors(), cleanTmpFolders(), installServicesSequential(), killOldInstances(), prepareService(), processWindow(), refreshAliases(), refreshGitRepos(), refreshHostname(), refreshVhosts(), savePath(), scanFolders(), sysInfos(), and updateConfig().
|
private |
Definition at line 21 of file class.action.startup.php.
Referenced by installServicesSequential().
|
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.
Referenced by scanFolders().
|
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.