![]() |
Bearsampp 2026.9.23
|
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 48 of file class.action.startup.php.
References $bearsamppBins, $bearsamppCore, $bearsamppLang, $bearsamppRoot, APP_TITLE, Util\getMicrotime(), Path\getRootPath(), 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 765 of file class.action.startup.php.
References $bearsamppLang, $result, Path\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 1374 of file class.action.startup.php.
References $startTime, Win32Service\getServices(), 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 823 of file class.action.startup.php.
References $bearsamppLang, Registry\APP_BINS_REG_ENTRY, 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 646 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 630 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 1428 of file class.action.startup.php.
References Win32Service\getServices(), and Log\trace().
Referenced by prepareService().
|
private |
Checks the application path and logs the last path content.
Definition at line 705 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 791 of file class.action.startup.php.
References $bearsamppLang, $bearsamppRoot, Registry\APP_PATH_REG_ENTRY, Path\formatWindowsPath(), Path\getRootPath(), 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 855 of file class.action.startup.php.
References $bearsamppLang, Registry\APP_BINS_REG_ENTRY, 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 561 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 530 of file class.action.startup.php.
References $bearsamppCore, $bearsamppLang, $bearsamppRoot, Util\clearFolder(), Path\getTmpPath(), Lang\STARTUP_CLEAN_TMP_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Creates SSL certificates if they do not already exist or are expired. Logs the creation process.
Definition at line 909 of file class.action.startup.php.
References $bearsamppBins, $bearsamppLang, Log\error(), Log\info(), Lang\STARTUP_GEN_SSL_CRT_TEXT, and Log\trace().
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 972 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 1002 of file class.action.startup.php.
References $bearsamppBins, $bearsamppLang, $error, Util\getMicrotime(), Win32Service\getServices(), Log\info(), Lang\LOADING_START_SERVICE, prepareService(), Symlinks\setSkipSymlinkCreation(), ServiceHelper\startAllServicesParallel(), Lang\STARTUP_SERVICE_ERROR, Lang\STARTUP_VERIFY_SERVICE_TEXT, Log\trace(), Log\warning(), and writeLog().
Referenced by installServices().
|
private |
Kills old instances of Bearsampp processes.
Definition at line 581 of file class.action.startup.php.
References $bearsamppLang, $proc, Win32Ps\EXECUTABLE_PATH, Path\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 1156 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(), ServiceHelper\isPortInUse(), Win32Ps\killBins(), BinApache\SERVICE_NAME, BinMailpit\SERVICE_NAME, BinMariadb\SERVICE_NAME, BinMemcached\SERVICE_NAME, BinMysql\SERVICE_NAME, BinPostgresql\SERVICE_NAME, BinXlight\SERVICE_NAME, Win32Service\SERVICE_STATE, Lang\STARTUP_SERVICE_CREATE_ERROR, Lang\STARTUP_SERVICE_PORT_ERROR, Log\trace(), Win32Service\VBS_PATH_NAME, Win32Service\WIN32_SERVICE_RUNNING, 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 90 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, Path\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 677 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 1353 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 616 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 691 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 296 of file class.action.startup.php.
References $bearsamppBins, $bearsamppConfig, $bearsamppCore, $bearsamppLang, $bearsamppRoot, Util\deleteFolder(), Path\getLogsPath(), Path\getTmpPath(), Lang\STARTUP_ROTATION_LOGS_TEXT, and Log\trace().
Referenced by processWindow().
|
private |
Saves the current application path.
Definition at line 780 of file class.action.startup.php.
References $bearsamppCore, Path\getLastPath(), 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 720 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 663 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 892 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 1477 of file class.action.startup.php.
References $bearsamppRoot, Log\debug(), and Path\getStartupLogFilePath().
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 28 of file class.action.startup.php.
Referenced by installServicesSequential().
|
private |
Definition at line 34 of file class.action.startup.php.
|
private |
Definition at line 22 of file class.action.startup.php.
|
private |
Definition at line 31 of file class.action.startup.php.
Referenced by scanFolders().
|
private |
Definition at line 19 of file class.action.startup.php.
|
private |
Definition at line 25 of file class.action.startup.php.
Referenced by checkApacheServiceWithTimeout().
| const GAUGE_OTHERS = 19 |
Definition at line 40 of file class.action.startup.php.
| const GAUGE_SERVICES = 5 |
Definition at line 37 of file class.action.startup.php.