37 if (isset($args[0]) && !empty($args[0]) && isset($args[1]) && !empty($args[1])) {
38 $this->pathsToScan = array();
39 $this->version = $args[1];
45 $this->changePort =
true;
47 foreach ($folderList as $folder) {
48 $this->pathsToScan[] = array(
49 'path' =>
$bearsamppBins->getApache()->getRootPath() .
'/' . $folder,
50 'includes' => array(
'.ini',
'.conf'),
58 $this->changePort =
false;
60 foreach ($folderList as $folder) {
61 $this->pathsToScan[] = array(
63 'includes' => array(
'.php',
'.bat',
'.ini',
'.reg',
'.inc'),
71 $this->changePort =
true;
73 foreach ($folderList as $folder) {
74 $this->pathsToScan[] = array(
75 'path' =>
$bearsamppBins->getMysql()->getRootPath() .
'/' . $folder,
76 'includes' => array(
'my.ini'),
82 $this->currentVersion =
$bearsamppBins->getMariadb()->getVersion();
84 $this->changePort =
true;
86 foreach ($folderList as $folder) {
87 $this->pathsToScan[] = array(
88 'path' =>
$bearsamppBins->getMariadb()->getRootPath() .
'/' . $folder,
89 'includes' => array(
'my.ini'),
93 } elseif ($args[0] ==
$bearsamppBins->getPostgresql()->getName()) {
95 $this->currentVersion =
$bearsamppBins->getPostgresql()->getVersion();
97 $this->changePort =
true;
99 foreach ($folderList as $folder) {
100 $this->pathsToScan[] = array(
101 'path' =>
$bearsamppBins->getPostgresql()->getRootPath() .
'/' . $folder,
102 'includes' => array(
'.ber',
'.conf',
'.bat'),
108 $this->currentVersion =
$bearsamppBins->getNodejs()->getVersion();
109 $this->service =
null;
110 $this->changePort =
false;
112 foreach ($folderList as $folder) {
113 $this->pathsToScan[] = array(
114 'path' =>
$bearsamppBins->getNodejs()->getRootPath() .
'/' . $folder .
'/etc',
115 'includes' => array(
'npmrc'),
118 $this->pathsToScan[] = array(
119 'path' =>
$bearsamppBins->getNodejs()->getRootPath() .
'/' . $folder .
'/node_modules/npm',
120 'includes' => array(
'npmrc'),
124 } elseif ($args[0] ==
$bearsamppBins->getFilezilla()->getName()) {
126 $this->currentVersion =
$bearsamppBins->getFilezilla()->getVersion();
128 $this->changePort =
true;
130 foreach ($folderList as $folder) {
131 $this->pathsToScan[] = array(
132 'path' =>
$bearsamppBins->getFilezilla()->getRootPath() .
'/' . $folder,
133 'includes' => array(
'.xml'),
137 } elseif ($args[0] ==
$bearsamppBins->getMemcached()->getName()) {
139 $this->currentVersion =
$bearsamppBins->getMemcached()->getVersion();
141 $this->changePort =
true;
147 $this->bearsamppSplash =
new Splash();
148 $this->bearsamppSplash->init(
150 self::GAUGE_SERVICES * count(
$bearsamppBins->getServices()) + self::GAUGE_OTHERS,
154 $bearsamppWinbinder->setHandler($this->bearsamppSplash->getWbWindow(), $this,
'processWindow', 1000);
155 $bearsamppWinbinder->mainLoop();
156 $bearsamppWinbinder->reset();
173 if ($this->version == $this->currentVersion) {
175 $bearsamppWinbinder->destroyWindow($window);
179 $this->bearsamppSplash->incrProgressBar();
180 if (!empty($this->pathsToScan)) {
185 $this->bearsamppSplash->incrProgressBar();
186 if ($this->bin->switchVersion($this->version,
true) ===
false) {
187 $this->bearsamppSplash->incrProgressBar(self::GAUGE_SERVICES * count(
$bearsamppBins->getServices()) + self::GAUGE_OTHERS);
188 $bearsamppWinbinder->destroyWindow($window);
192 if ($this->service !=
null) {
195 $this->bearsamppSplash->incrProgressBar();
196 $this->service->stop();
198 $this->bearsamppSplash->incrProgressBar();
203 $this->bearsamppSplash->incrProgressBar();
208 $this->bearsamppSplash->incrProgressBar();
212 if ($this->changePort) {
213 $this->bin->reload();
214 $this->bin->changePort($this->bin->getPort());
218 if ($this->service !=
null) {
221 $this->bearsamppSplash->incrProgressBar();
222 $this->service->start();
224 $this->bearsamppSplash->incrProgressBar();
227 $this->bearsamppSplash->incrProgressBar(self::GAUGE_SERVICES * count(
$bearsamppBins->getServices()) + 1);
228 $bearsamppWinbinder->messageBoxInfo(
231 $bearsamppWinbinder->destroyWindow($window);
234 $this->bearsamppSplash->incrProgressBar(2);
239 $this->bearsamppSplash->incrProgressBar();
243 $bearsamppWinbinder->messageBoxInfo(
249 $bearsamppWinbinder->destroyWindow($window);