44 $bearsamppWinbinder->reset();
49 $screenWidth = intval($screenArea[2]);
50 $screenHeight = intval($screenArea[3]);
51 $xPos = $screenWidth - self::WINDOW_WIDTH;
52 $yPos = $screenHeight - self::WINDOW_HEIGHT - 5;
55 $this->wbWindow = $bearsamppWinbinder->createWindow(
null, ToolDialog,
null, $xPos, $yPos, self::WINDOW_WIDTH, self::WINDOW_HEIGHT, WBC_TOP,
null);
57 $this->wbProgressBar = $bearsamppWinbinder->createProgressBar($this->wbWindow, self::GAUGE, 42, 20, 290, 15);
60 $bearsamppWinbinder->setHandler($this->wbWindow, $this,
'processLoading', 10);
61 $bearsamppWinbinder->mainLoop();
73 for ($i = 0; $i < $nb; $i++) {
74 $bearsamppWinbinder->incrProgressBar($this->wbProgressBar);
75 $bearsamppWinbinder->drawImage($this->wbWindow,
$bearsamppCore->getImagesPath() .
'/bearsampp.bmp', 4, 2, 32, 32);
78 $bearsamppWinbinder->wait();
79 $bearsamppWinbinder->wait($this->wbWindow);
106 $startTime = microtime(
true);
107 $maxLoadingTime = 15;
109 while ($iterations < $maxIterations && (microtime(
true) - $startTime) < $maxLoadingTime) {
111 $bearsamppWinbinder->resetProgressBar($this->wbProgressBar);
115 for ($i = 0; $i < self::GAUGE && (microtime(
true) - $startTime) < $maxLoadingTime; $i++) {
122 if ($allServicesStarted) {
128 Util::logTrace(
'Loading iteration ' . $iterations .
' completed, checking services again');
131 if ($iterations >= $maxIterations) {
132 Util::logTrace(
'Maximum iterations reached (' . $maxIterations .
'), some services may not have started properly');
135 if ((microtime(
true) - $startTime) >= $maxLoadingTime) {
136 Util::logTrace(
'Loading timeout reached (' . $maxLoadingTime .
' seconds), some services may not have started properly');
156 Util::logTrace(
'Checking if all services have started successfully');
161 if (!$service->isEnable()) {
162 Util::logTrace(
'Service ' . $sName .
' is disabled, skipping check');
167 $checkStartTime = microtime(
true);
169 $serviceRunning =
false;
173 $tempFile =
$bearsamppCore->getTmpPath() .
'/service_check_' . uniqid() .
'.tmp';
176 $checkCmd =
'php -r "' .
177 'require \'' .
$bearsamppRoot->getLibsPath() .
'/classes/class.win32service.php\'; ' .
178 '$service = new Win32Service(\'' . $service->getName() .
'\');
' .
179 '$status = $service->status();
' .
180 'file_put_contents(\
'' . $tempFile .
'\', $status == Win32Service::STATE_RUNNING ? \
'1\' : \'0\'); ' .
181 'exit(0);" > nul 2>&1';
184 pclose(popen(
'start /B ' . $checkCmd,
'r'));
187 $startWait = microtime(
true);
188 while (!file_exists($tempFile) && (microtime(
true) - $startWait < $checkTimeout)) {
193 if (file_exists($tempFile)) {
194 $result = file_get_contents($tempFile);
195 $serviceRunning = (
$result ===
'1');
197 Util::logTrace(
'Service ' . $sName .
' status check: ' . ($serviceRunning ?
'running' :
'not running'));
200 $serviceRunning =
false;
202 }
catch (\Exception $e) {
203 Util::logTrace(
'Exception during service status check for ' . $sName .
': ' . $e->getMessage());
204 $serviceRunning =
false;
207 if (!$serviceRunning) {
214 Util::logTrace(
'All services started check result: ' . ($allStarted ?
'true' :
'false'));