![]() |
Bearsampp 2026.7.11
|
Static Public Member Functions | |
| static | getAllServiceNames () |
| static | getBinFromServiceName ($serviceName, $bearsamppBins) |
| static | getServiceDisplayName ($bin, $service) |
| static | getServicePort ($serviceName, $bearsamppBins) |
| static | getSyntaxCheckCmd ($serviceName, $bearsamppBins=null) |
| static | hasSyntaxCheck ($serviceName) |
| static | processServices ($bearsamppBins, callable $callback) |
| static | restartService ($service) |
| static | startAllServicesParallel ($serviceInfos, ?callable $progressCallback=null, $startupTimeout=30) |
| static | startService ($bin, $syntaxCheckCmd=null, $showErrors=true) |
| static | stopAllServicesParallel ($bearsamppBins, ?callable $progressCallback=null, $shutdownTimeout=15) |
| static | stopService ($service) |
Static Private Member Functions | |
| static | allServicesRunning ($serviceInfos) |
| static | allServicesStopped ($services) |
| static | forceKillService ($serviceName) |
| static | initializeMappings ($bearsamppBins) |
| static | shutdownServicesParallel ($services, ?callable $progressCallback=null, $shutdownTimeout=15) |
| static | shutdownServicesSequential ($services, ?callable $progressCallback=null) |
| static | startServicesParallel ($serviceInfos, ?callable $progressCallback=null, $startupTimeout=30) |
| static | startServicesSequential ($serviceInfos, ?callable $progressCallback=null) |
Static Private Attributes | |
| static | $serviceMap = null |
| static | $syntaxCheckMap = null |
Class ServiceHelper
Utility class for service management operations. Provides centralized methods for service lookup, syntax check commands, and common service operations to eliminate code duplication.
Definition at line 17 of file class.servicehelper.php.
|
staticprivate |
Check if all services are running
| array | $serviceInfos | Array of service information |
Definition at line 579 of file class.servicehelper.php.
Referenced by startServicesParallel(), and startServicesSequential().
|
staticprivate |
Check if all services are stopped
| array | $services | Array of services |
Definition at line 397 of file class.servicehelper.php.
Referenced by shutdownServicesParallel(), and shutdownServicesSequential().
|
staticprivate |
Force kill a service by process name
| string | $serviceName | The service name |
Definition at line 369 of file class.servicehelper.php.
References Win32Ps\killBins(), BinApache\SERVICE_NAME, BinMailpit\SERVICE_NAME, BinMariadb\SERVICE_NAME, BinMemcached\SERVICE_NAME, BinMysql\SERVICE_NAME, BinPostgresql\SERVICE_NAME, BinXlight\SERVICE_NAME, and Log\trace().
Referenced by shutdownServicesParallel(), and shutdownServicesSequential().
|
static |
Get all service names
Definition at line 161 of file class.servicehelper.php.
References BinApache\SERVICE_NAME, BinMailpit\SERVICE_NAME, BinMariadb\SERVICE_NAME, BinMemcached\SERVICE_NAME, BinMysql\SERVICE_NAME, BinPostgresql\SERVICE_NAME, and BinXlight\SERVICE_NAME.
|
static |
Get binary instance from service name
| string | $serviceName | The service name |
| object | $bearsamppBins | The bins object |
Definition at line 67 of file class.servicehelper.php.
References $bearsamppBins, and initializeMappings().
Referenced by getServicePort(), processServices(), and ActionRestartAllServices\processWindow().
|
static |
Get service display name (Name + Version + Service Name)
| object | $bin | The binary instance |
| object | $service | The service instance |
Definition at line 95 of file class.servicehelper.php.
Referenced by ActionRestartAllServices\processWindow(), and ActionStartAllServices\processWindow().
|
static |
Get port for a service
| string | $serviceName | The service name |
| object | $bearsamppBins | The bins object |
Definition at line 200 of file class.servicehelper.php.
References $bearsamppBins, and getBinFromServiceName().
|
static |
Get syntax check command for a service
| string | $serviceName | The service name |
| object | $bearsamppBins | The bins object (for initialization) |
Definition at line 80 of file class.servicehelper.php.
References $bearsamppBins, and initializeMappings().
Referenced by processServices(), and ActionRestartAllServices\processWindow().
|
static |
Check if a service has syntax check capability
| string | $serviceName | The service name |
Definition at line 180 of file class.servicehelper.php.
References BinApache\CMD_SYNTAX_CHECK, BinMariadb\CMD_SYNTAX_CHECK, BinMysql\CMD_SYNTAX_CHECK, BinApache\SERVICE_NAME, BinMariadb\SERVICE_NAME, and BinMysql\SERVICE_NAME.
|
staticprivate |
Initialize service mappings
| object | $bearsamppBins | The bins object |
Definition at line 37 of file class.servicehelper.php.
References $bearsamppBins, BinApache\CMD_SYNTAX_CHECK, BinMariadb\CMD_SYNTAX_CHECK, BinMysql\CMD_SYNTAX_CHECK, BinApache\SERVICE_NAME, BinMailpit\SERVICE_NAME, BinMariadb\SERVICE_NAME, BinMemcached\SERVICE_NAME, BinMysql\SERVICE_NAME, BinPostgresql\SERVICE_NAME, and BinXlight\SERVICE_NAME.
Referenced by getBinFromServiceName(), getSyntaxCheckCmd(), and processServices().
|
static |
Process all services with a callback function
| object | $bearsamppBins | The bins object |
| callable | $callback | Function to call for each service: function($serviceName, $service, $bin, $syntaxCheckCmd) |
Definition at line 107 of file class.servicehelper.php.
References $bearsamppBins, getBinFromServiceName(), getSyntaxCheckCmd(), and initializeMappings().
Referenced by ActionStartAllServices\processWindow().
|
static |
Restart a service
| object | $service | The service instance |
Definition at line 151 of file class.servicehelper.php.
|
staticprivate |
Shutdown services in parallel (non-blocking)
Phase 1: Send stop commands to all services (non-blocking) Phase 2: Monitor their status until all stopped or timeout Phase 3: Force kill any services still running
| array | $services | Array of services |
| callable | null | $progressCallback | Optional progress callback |
| int | $shutdownTimeout | Timeout in seconds |
Definition at line 274 of file class.servicehelper.php.
References allServicesStopped(), forceKillService(), and Log\trace().
Referenced by stopAllServicesParallel().
|
staticprivate |
Shutdown services sequentially (fallback method)
Stops services one by one, waiting for each to complete. Used as fallback when parallel shutdown fails.
| array | $services | Array of services |
| callable | null | $progressCallback | Optional progress callback |
Definition at line 339 of file class.servicehelper.php.
References allServicesStopped(), forceKillService(), and Log\trace().
Referenced by stopAllServicesParallel().
|
static |
Start all services in parallel for optimized startup
Sends start commands to all services simultaneously, then monitors their status. Falls back to sequential startup if parallel fails. Significantly reduces startup time.
Performance: 40-60% faster startup (parallel vs sequential)
| array | $serviceInfos | Array of service information arrays with 'service', 'bin', 'name' keys |
| callable | null | $progressCallback | Optional callback: function($current, $total, $serviceName) |
| int | $startupTimeout | Timeout in seconds (default: 30) |
Definition at line 420 of file class.servicehelper.php.
References Log\info(), startServicesParallel(), startServicesSequential(), and Log\trace().
Referenced by ActionStartup\installServicesSequential().
|
static |
Start a service with optional syntax check
| object | $bin | The binary instance |
| string | null | $syntaxCheckCmd | The syntax check command (optional) |
| bool | $showErrors | Whether to show error messages (default: true) |
Definition at line 129 of file class.servicehelper.php.
References Util\startService().
Referenced by ActionRestartAllServices\processWindow(), and ActionStartAllServices\processWindow().
|
staticprivate |
Start services in parallel (non-blocking)
Phase 1: Send start commands to all services (non-blocking) Phase 2: Monitor their status until all running or timeout Phase 3: Retry any services that failed to start
| array | $serviceInfos | Array of service information |
| callable | null | $progressCallback | Optional progress callback |
| int | $startupTimeout | Timeout in seconds |
Definition at line 463 of file class.servicehelper.php.
References allServicesRunning(), and Log\trace().
Referenced by startAllServicesParallel().
|
staticprivate |
Start services sequentially (fallback method)
Starts services one by one, waiting for each to complete. Used as fallback when parallel startup fails.
| array | $serviceInfos | Array of service information |
| callable | null | $progressCallback | Optional progress callback |
Definition at line 542 of file class.servicehelper.php.
References allServicesRunning(), and Log\trace().
Referenced by startAllServicesParallel().
|
static |
Stop all services in parallel for optimized shutdown
Sends stop commands to all services simultaneously, then monitors their status. Falls back to sequential shutdown if parallel fails. Significantly reduces shutdown time.
Performance: 40-60% faster shutdown (parallel vs sequential)
| object | $bearsamppBins | The bins object |
| callable | null | $progressCallback | Optional callback: function($current, $total, $serviceName) |
| int | $shutdownTimeout | Timeout in seconds (default: 15) |
Definition at line 230 of file class.servicehelper.php.
References $bearsamppBins, Log\info(), shutdownServicesParallel(), shutdownServicesSequential(), and Log\trace().
Referenced by ActionStopAllServices\processWindow().
|
static |
Stop a service
| object | $service | The service instance |
Definition at line 140 of file class.servicehelper.php.
Referenced by ActionRestartAllServices\processWindow().
|
staticprivate |
Definition at line 23 of file class.servicehelper.php.
|
staticprivate |
Definition at line 29 of file class.servicehelper.php.