|
Bearsampp 2026.3.26
API documentation
|
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(), 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 706 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 1205 of file class.action.startup.php.
References $startTime, and Util\logTrace().
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 765 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 595 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 578 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 1254 of file class.action.startup.php.
References Util\logTrace().
Referenced by prepareService().
|
private |
Checks the application path and logs the last path content.
Definition at line 654 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 732 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 798 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 509 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 479 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 854 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 873 of file class.action.startup.php.
References $bearsamppBins, $bearsamppLang, $bearsamppRoot, installServicesSequential(), and Util\logTrace().
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 900 of file class.action.startup.php.
References $bearsamppBins, $bearsamppLang, $error, Util\getMicrotime(), Util\logTrace(), prepareService(), Lang\STARTUP_SERVICE_ERROR, and writeLog().
Referenced by installServices().
|
private |
Kills old instances of Bearsampp processes.
Definition at line 529 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().
|
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 1030 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(), 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_SERVICE_CREATE_ERROR, Lang\STARTUP_SERVICE_PORT_ERROR, 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 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(), 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(), updateConfig(), and writeLog().
|
private |
Refreshes the aliases in the Apache configuration.
Definition at line 626 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 1185 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 564 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 640 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 265 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 721 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 669 of file class.action.startup.php.
References $bearsamppCore, $bearsamppLang, $rootPath, Util\getFilesToScan(), Util\getMicrotime(), Util\logDebug(), Util\logTrace(), Lang\STARTUP_SCAN_FOLDERS_TEXT, and writeLog().
Referenced by processWindow().
|
private |
Logs system information.
Definition at line 612 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 837 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 1299 of file class.action.startup.php.
References $bearsamppRoot, and Util\logDebug().
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.