53 if (isset($args[0]) && !empty($args[0]) && isset($args[1]) && !empty($args[1])) {
54 $this->pathsToScan = array();
55 $this->version = $args[1];
61 $this->changePort =
true;
63 foreach ($folderList as $folder) {
64 $this->pathsToScan[] = array(
65 'path' =>
$bearsamppBins->getApache()->getRootPath() .
'/' . $folder,
66 'includes' => array(
'.ini',
'.conf'),
74 $this->changePort =
false;
76 foreach ($folderList as $folder) {
77 $this->pathsToScan[] = array(
79 'includes' => array(
'.php',
'.bat',
'.ini',
'.reg',
'.inc'),
87 $this->changePort =
true;
89 foreach ($folderList as $folder) {
90 $this->pathsToScan[] = array(
91 'path' =>
$bearsamppBins->getMysql()->getRootPath() .
'/' . $folder,
92 'includes' => array(
'my.ini'),
98 $this->currentVersion =
$bearsamppBins->getMariadb()->getVersion();
100 $this->changePort =
true;
102 foreach ($folderList as $folder) {
103 $this->pathsToScan[] = array(
104 'path' =>
$bearsamppBins->getMariadb()->getRootPath() .
'/' . $folder,
105 'includes' => array(
'my.ini'),
109 } elseif ($args[0] ==
$bearsamppBins->getPostgresql()->getName()) {
111 $this->currentVersion =
$bearsamppBins->getPostgresql()->getVersion();
113 $this->changePort =
true;
115 foreach ($folderList as $folder) {
116 $this->pathsToScan[] = array(
117 'path' =>
$bearsamppBins->getPostgresql()->getRootPath() .
'/' . $folder,
118 'includes' => array(
'.ber',
'.conf',
'.bat'),
124 $this->currentVersion =
$bearsamppBins->getNodejs()->getVersion();
125 $this->service =
null;
126 $this->changePort =
false;
128 foreach ($folderList as $folder) {
129 $this->pathsToScan[] = array(
130 'path' =>
$bearsamppBins->getNodejs()->getRootPath() .
'/' . $folder .
'/etc',
131 'includes' => array(
'npmrc'),
134 $this->pathsToScan[] = array(
135 'path' =>
$bearsamppBins->getNodejs()->getRootPath() .
'/' . $folder .
'/node_modules/npm',
136 'includes' => array(
'npmrc'),
140 } elseif ($args[0] ==
$bearsamppBins->getMemcached()->getName()) {
142 $this->currentVersion =
$bearsamppBins->getMemcached()->getVersion();
144 $this->changePort =
true;
147 $this->currentVersion =
$bearsamppBins->getMailpit()->getVersion();
149 $this->changePort =
false;
151 foreach ($folderList as $folder) {
152 $this->pathsToScan[] = array(
153 'path' =>
$bearsamppBins->getMailpit()->getRootPath() .
'/' . $folder,
154 'includes' => array(
'.conf'),
160 $this->currentVersion =
$bearsamppBins->getXlight()->getVersion();
162 $this->changePort =
true;
164 foreach ($folderList as $folder) {
165 $this->pathsToScan[] = array(
166 'path' =>
$bearsamppBins->getXlight()->getRootPath() .
'/' . $folder,
167 'includes' => array(
'.conf, ftpd.hosts, ftpd.option, ftpd.password, ftpd.rules, ftpd.users, .ini'),
176 $this->bearsamppSplash =
new Splash();
177 $this->bearsamppSplash->init(
179 self::GAUGE_SERVICES * count(
$bearsamppBins->getServices()) + self::GAUGE_OTHERS,
183 $bearsamppWinbinder->setHandler($this->bearsamppSplash->getWbWindow(), $this,
'processWindow', 1000);
184 $bearsamppWinbinder->mainLoop();
185 $bearsamppWinbinder->reset();
202 if ($this->version == $this->currentVersion) {
204 $bearsamppWinbinder->destroyWindow($window);
208 $this->bearsamppSplash->incrProgressBar();
209 if (!empty($this->pathsToScan)) {
214 $this->bearsamppSplash->incrProgressBar();
215 if ($this->bin->switchVersion($this->version,
true) ===
false) {
216 $this->bearsamppSplash->incrProgressBar(self::GAUGE_SERVICES * count(
$bearsamppBins->getServices()) + self::GAUGE_OTHERS);
217 $bearsamppWinbinder->destroyWindow($window);
221 if ($this->service !=
null) {
224 $this->bearsamppSplash->incrProgressBar();
225 $this->service->stop();
227 $this->bearsamppSplash->incrProgressBar();
232 $this->bearsamppSplash->incrProgressBar();
237 $this->bearsamppSplash->incrProgressBar();
241 if ($this->changePort) {
242 $this->bin->reload();
243 $this->bin->changePort($this->bin->getPort());
247 if ($this->service !=
null) {
250 $this->bearsamppSplash->incrProgressBar();
251 $this->service->start();
253 $this->bearsamppSplash->incrProgressBar();
256 $this->bearsamppSplash->incrProgressBar(self::GAUGE_SERVICES * count(
$bearsamppBins->getServices()) + 1);
263 $bearsamppWinbinder->messageBoxInfo(
269 $bearsamppWinbinder->destroyWindow($window);
276 'Starting registry adjustment for key: %s | Current value: %s',
281 $this->bearsamppSplash->setTextLoading(sprintf(
286 $this->bearsamppSplash->incrProgressBar(2);
291 'Registry update completed | Key: %s | New value: %s | Previous value: %s',
298 'Resetting services: %s',
305 $this->bearsamppSplash->incrProgressBar();
311 $bearsamppWinbinder->messageBoxInfo(
320 $bearsamppWinbinder->destroyWindow($window);
334 if ($this->bin->getName() == $GLOBALS[
'bearsamppBins']->getApache()->getName()) {
335 $configSection = self::CONFIG_SECTION_APACHE;
337 } elseif ($this->bin->getName() == $GLOBALS[
'bearsamppBins']->getPhp()->getName()) {
338 $configSection = self::CONFIG_SECTION_PHP;
340 } elseif ($this->bin->getName() == $GLOBALS[
'bearsamppBins']->getMysql()->getName()) {
341 $configSection = self::CONFIG_SECTION_MYSQL;
343 } elseif ($this->bin->getName() == $GLOBALS[
'bearsamppBins']->getMariadb()->getName()) {
344 $configSection = self::CONFIG_SECTION_MARIADB;
346 } elseif ($this->bin->getName() == $GLOBALS[
'bearsamppBins']->getPostgresql()->getName()) {
347 $configSection = self::CONFIG_SECTION_POSTGRESQL;
349 } elseif ($this->bin->getName() == $GLOBALS[
'bearsamppBins']->getNodejs()->getName()) {
350 $configSection = self::CONFIG_SECTION_NODEJS;
352 } elseif ($this->bin->getName() == $GLOBALS[
'bearsamppBins']->getMemcached()->getName()) {
353 $configSection = self::CONFIG_SECTION_MEMCACHED;
355 } elseif ($this->bin->getName() == $GLOBALS[
'bearsamppBins']->getMailpit()->getName()) {
356 $configSection = self::CONFIG_SECTION_MAILPIT;
358 } elseif ($this->bin->getName() == $GLOBALS[
'bearsamppBins']->getXlight()->getName()) {
359 $configSection = self::CONFIG_SECTION_XLIGHT;
364 if (!empty($configSection)) {
370 if (class_exists(
'TrayMenu')) {
371 $trayMenu = TrayMenu::getInstance();
372 if (method_exists($trayMenu,
'updateSectionVersion')) {
373 $trayMenu->updateSectionVersion(
374 strtoupper($configSection),