71 if (isset($args[0]) && !empty($args[0]) && isset($args[1]) && !empty($args[1])) {
72 $this->pathsToScan = array();
73 $this->version = $args[1];
79 $this->changePort =
true;
81 foreach ($folderList as $folder) {
82 $this->pathsToScan[] = array(
84 'includes' => array(
'.ini',
'.conf'),
92 $this->changePort =
false;
94 foreach ($folderList as $folder) {
95 $this->pathsToScan[] = array(
97 'includes' => array(
'.php',
'.bat',
'.ini',
'.reg',
'.inc'),
105 $this->changePort =
true;
107 foreach ($folderList as $folder) {
108 $this->pathsToScan[] = array(
110 'includes' => array(
'my.ini'),
116 $this->currentVersion =
$bearsamppBins->getMariadb()->getVersion();
118 $this->changePort =
true;
120 foreach ($folderList as $folder) {
121 $this->pathsToScan[] = array(
123 'includes' => array(
'my.ini'),
127 } elseif ($args[0] ==
$bearsamppBins->getPostgresql()->getName()) {
129 $this->currentVersion =
$bearsamppBins->getPostgresql()->getVersion();
131 $this->changePort =
true;
133 foreach ($folderList as $folder) {
134 $this->pathsToScan[] = array(
136 'includes' => array(
'.conf',
'.bat'),
142 $this->currentVersion =
$bearsamppBins->getNodejs()->getVersion();
143 $this->service =
null;
144 $this->changePort =
false;
146 foreach ($folderList as $folder) {
147 $this->pathsToScan[] = array(
149 'includes' => array(
'npmrc'),
152 $this->pathsToScan[] = array(
154 'includes' => array(
'npmrc'),
158 } elseif ($args[0] ==
$bearsamppBins->getMemcached()->getName()) {
160 $this->currentVersion =
$bearsamppBins->getMemcached()->getVersion();
162 $this->changePort =
true;
165 $this->currentVersion =
$bearsamppBins->getMailpit()->getVersion();
167 $this->changePort =
false;
169 foreach ($folderList as $folder) {
170 $this->pathsToScan[] = array(
172 'includes' => array(
'.conf'),
178 $this->currentVersion =
$bearsamppBins->getXlight()->getVersion();
180 $this->changePort =
true;
182 foreach ($folderList as $folder) {
183 $this->pathsToScan[] = array(
185 'includes' => array(
'.conf, ftpd.hosts, ftpd.option, ftpd.password, ftpd.rules, ftpd.users, .ini'),
194 $this->bearsamppSplash =
new Splash();
195 $this->bearsamppSplash->init(
197 self::GAUGE_SERVICES * count(
$bearsamppBins->getServices()) + self::GAUGE_OTHERS,
201 $bearsamppWinbinder->setHandler($this->bearsamppSplash->getWbWindow(), $this,
'processWindow', 1000);
202 $bearsamppWinbinder->mainLoop();
203 $bearsamppWinbinder->reset();
220 if ($this->version == $this->currentVersion) {
222 $bearsamppWinbinder->destroyWindow($window);
226 $this->bearsamppSplash->incrProgressBar();
227 if (!empty($this->pathsToScan)) {
232 $this->bearsamppSplash->incrProgressBar();
233 if ($this->bin->switchVersion($this->version,
true) ===
false) {
234 $this->bearsamppSplash->incrProgressBar(self::GAUGE_SERVICES * count(
$bearsamppBins->getServices()) + self::GAUGE_OTHERS);
235 $bearsamppWinbinder->destroyWindow($window);
239 if ($this->service !=
null) {
242 $this->bearsamppSplash->incrProgressBar();
243 $this->service->stop();
247 $this->bearsamppSplash->incrProgressBar();
252 $this->bearsamppSplash->incrProgressBar();
257 $this->bearsamppSplash->incrProgressBar();
262 if ($this->service !=
null) {
264 if ($this->bin->getName() ==
$bearsamppBins->getPhp()->getName()) {
266 Log::trace(
"Refreshed service reference from reloaded Apache bin (for PHP)");
269 if ($freshBin !==
null) {
270 $this->service = $freshBin->getService();
271 Log::trace(
"Refreshed service reference from reloaded " . $this->bin->getName() .
" bin");
277 if ($this->changePort) {
278 $this->bin->reload();
279 $this->bin->changePort($this->bin->getPort());
283 if ($this->service !=
null) {
286 $this->bearsamppSplash->incrProgressBar();
287 $this->service->start();
289 $this->bearsamppSplash->incrProgressBar();
292 $this->bearsamppSplash->incrProgressBar(self::GAUGE_SERVICES * count(
$bearsamppBins->getServices()) + 1);
299 global $bearsamppRegistry;
300 $currentRegValue = $bearsamppRegistry->getAppBinsRegKey(
false);
305 'Starting registry adjustment for key: %s | Current value: %s',
312 $newRegValue = $bearsamppRegistry->setAppBinsRegKey($currentRegValue);
314 $this->bearsamppSplash->setTextLoading(
321 $this->bearsamppSplash->incrProgressBar(2);
324 'Registry update completed | Key: %s | New value: %s | Previous value: %s',
336 Log::trace(
'Version switch complete - service restarted with new version');
337 $this->bearsamppSplash->incrProgressBar();
341 if ($remainingServicesCount > 0) {
342 $this->bearsamppSplash->incrProgressBar($remainingServicesCount);
345 Log::trace(
'Version switch process completed successfully');
348 $bearsamppWinbinder->messageBoxInfo(
354 $bearsamppWinbinder->destroyWindow($window);
368 if ($this->bin->getName() ==
$GLOBALS[
'bearsamppBins']->getApache()->getName()) {
369 $configSection = self::CONFIG_SECTION_APACHE;
371 } elseif ($this->bin->getName() ==
$GLOBALS[
'bearsamppBins']->getPhp()->getName()) {
372 $configSection = self::CONFIG_SECTION_PHP;
374 } elseif ($this->bin->getName() ==
$GLOBALS[
'bearsamppBins']->getMysql()->getName()) {
375 $configSection = self::CONFIG_SECTION_MYSQL;
377 } elseif ($this->bin->getName() ==
$GLOBALS[
'bearsamppBins']->getMariadb()->getName()) {
378 $configSection = self::CONFIG_SECTION_MARIADB;
380 } elseif ($this->bin->getName() ==
$GLOBALS[
'bearsamppBins']->getPostgresql()->getName()) {
381 $configSection = self::CONFIG_SECTION_POSTGRESQL;
383 } elseif ($this->bin->getName() ==
$GLOBALS[
'bearsamppBins']->getNodejs()->getName()) {
384 $configSection = self::CONFIG_SECTION_NODEJS;
386 } elseif ($this->bin->getName() ==
$GLOBALS[
'bearsamppBins']->getMemcached()->getName()) {
387 $configSection = self::CONFIG_SECTION_MEMCACHED;
389 } elseif ($this->bin->getName() ==
$GLOBALS[
'bearsamppBins']->getMailpit()->getName()) {
390 $configSection = self::CONFIG_SECTION_MAILPIT;
392 } elseif ($this->bin->getName() ==
$GLOBALS[
'bearsamppBins']->getXlight()->getName()) {
393 $configSection = self::CONFIG_SECTION_XLIGHT;
398 if (!empty($configSection)) {
404 if (class_exists(
'TrayMenu')) {
405 $trayMenu = TrayMenu::getInstance();
406 if (method_exists($trayMenu,
'updateSectionVersion')) {
407 $trayMenu->updateSectionVersion(
408 strtoupper($configSection),