Bearsampp 2026.3.26
API documentation
Loading...
Searching...
No Matches
ActionStartAllServices Class Reference

Public Member Functions

 __construct ($args)
 processWindow ($window, $id, $ctrl, $param1, $param2)

Data Fields

const GAUGE_PER_SERVICE = 1

Private Attributes

 $processed = false
 $splash

Detailed Description

Class ActionStartAllServices Handles starting all services with a single splash screen showing progress.

Definition at line 14 of file class.action.startAllServices.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( $args)

ActionStartAllServices constructor. Initializes the starting process, displays the splash screen, and sets up the main loop.

Parameters
array$argsCommand line arguments.

Definition at line 37 of file class.action.startAllServices.php.

38 {
39 global $bearsamppCore, $bearsamppLang, $bearsamppBins, $bearsamppWinbinder;
40
41 // Count enabled services for progress bar
42 $enabledServicesCount = count($bearsamppBins->getServices());
43
44 // Start splash screen
45 $this->splash = new Splash();
46 $this->splash->init(
48 self::GAUGE_PER_SERVICE * $enabledServicesCount + 1,
50 );
51
52 // Set handler for the splash screen window with 1000ms timeout
53 $bearsamppWinbinder->setHandler($this->splash->getWbWindow(), $this, 'processWindow', 1000);
54 $bearsamppWinbinder->mainLoop();
55 $bearsamppWinbinder->reset();
56 }
global $bearsamppBins
global $bearsamppLang
global $bearsamppCore
const LOADING_START_SERVICES
const MENU_START_SERVICES

References $bearsamppBins, $bearsamppCore, $bearsamppLang, Lang\LOADING_START_SERVICES, and Lang\MENU_START_SERVICES.

Member Function Documentation

◆ processWindow()

processWindow ( $window,
$id,
$ctrl,
$param1,
$param2 )

Processes the splash screen window events. Starts all services sequentially with progress updates.

Parameters
resource$windowThe window resource.
int$idThe event ID.
int$ctrlThe control ID.
mixed$param1Additional parameter 1.
mixed$param2Additional parameter 2.

Definition at line 68 of file class.action.startAllServices.php.

69 {
70 global $bearsamppBins, $bearsamppLang, $bearsamppWinbinder;
71
72 // Only process once
73 if ($this->processed) {
74 return;
75 }
76 $this->processed = true;
77
78 // Start all services using ServiceHelper
79 ServiceHelper::processServices($bearsamppBins, function($serviceName, $service, $bin, $syntaxCheckCmd) use ($bearsamppLang) {
80 $name = ServiceHelper::getServiceDisplayName($bin, $service);
81
82 $this->splash->incrProgressBar();
83 $this->splash->setTextLoading(sprintf($bearsamppLang->getValue(Lang::LOADING_START_SERVICE), $name));
84
85 // Start the service
86 ServiceHelper::startService($bin, $syntaxCheckCmd, false);
87 });
88
89 // Final update
90 $this->splash->incrProgressBar();
91 $this->splash->setTextLoading($bearsamppLang->getValue(Lang::LOADING_COMPLETE));
92
93 // Close the splash screen and exit cleanly
94 $bearsamppWinbinder->destroyWindow($window);
95 $bearsamppWinbinder->reset();
96 exit(0);
97 }
const LOADING_COMPLETE
const LOADING_START_SERVICE
static getServiceDisplayName($bin, $service)
static startService($bin, $syntaxCheckCmd=null, $showErrors=true)
static processServices($bearsamppBins, callable $callback)

References $bearsamppBins, $bearsamppLang, exit, ServiceHelper\getServiceDisplayName(), Lang\LOADING_COMPLETE, Lang\LOADING_START_SERVICE, ServiceHelper\processServices(), and ServiceHelper\startService().

Field Documentation

◆ $processed

$processed = false
private

Definition at line 24 of file class.action.startAllServices.php.

◆ $splash

$splash
private

Definition at line 19 of file class.action.startAllServices.php.

◆ GAUGE_PER_SERVICE

const GAUGE_PER_SERVICE = 1

Gauge value for progress bar increments.

Definition at line 29 of file class.action.startAllServices.php.


The documentation for this class was generated from the following file: