84 if ( $bearsamppRoot->getProcs() !==
false ) {
92 foreach ( $listProcs as
$proc ) {
98 $this->
writeLog(
'List bins modules:' );
99 foreach ( $bearsamppBins->getAll() as $module ) {
100 if ( !$module->isEnable() ) {
104 $this->
writeLog(
'-> ' . $module->getName() .
': ' . $module->getVersion() .
' (' . $module->getRelease() .
')' );
107 $this->
writeLog(
'List tools modules:' );
108 foreach ( $bearsamppTools->getAll() as $module ) {
109 if ( !$module->isEnable() ) {
113 $this->
writeLog(
'-> ' . $module->getName() .
': ' . $module->getVersion() .
' (' . $module->getRelease() .
')' );
116 $this->
writeLog(
'List apps modules:' );
117 foreach ( $bearsamppApps->getAll() as $module ) {
118 if ( !$module->isEnable() ) {
122 $this->
writeLog(
'-> ' . $module->getName() .
': ' . $module->getVersion() .
' (' . $module->getRelease() .
')' );
158 if ( !$this->restart && empty( $this->error ) ) {
163 $this->splash->incrProgressBar( 2 );
166 if ( $this->restart ) {
168 $this->splash->setTextLoading(
180 if ( !empty( $this->error ) ) {
181 $this->
writeLog(
'Error: ' . $this->error );
186 $bearsamppWinbinder->destroyWindow( $window );
197 $this->splash->incrProgressBar();
200 if ( !is_dir( $archivesPath ) ) {
201 mkdir( $archivesPath, 0777,
true );
206 $date = date(
'Y-m-d-His', time() );
207 $archiveLogsPath = $archivesPath .
'/' . $date;
208 $archiveScriptsPath = $archiveLogsPath .
'/scripts';
211 mkdir( $archiveLogsPath, 0777,
true );
212 mkdir( $archiveScriptsPath, 0777,
true );
216 $handle = @opendir( $archivesPath );
220 while (
false !== ($file = readdir( $handle )) ) {
221 if ( $file ==
'.' || $file ==
'..' ) {
224 $archives[] = $archivesPath .
'/' . $file;
232 for ( $i = 0; $i < $total; $i++ ) {
239 $handle = @opendir( $srcPath );
243 while (
false !== ($file = readdir( $handle )) ) {
244 if ( $file ==
'.' || $file ==
'..' || is_dir( $srcPath .
'/' . $file ) ) {
247 copy( $srcPath .
'/' . $file, $archiveLogsPath .
'/' . $file );
253 $handle = @opendir( $srcPath );
257 while (
false !== ($file = readdir( $handle )) ) {
258 if ( $file ==
'.' || $file ==
'..' || is_dir( $srcPath .
'/' . $file ) ) {
261 copy( $srcPath .
'/' . $file, $archiveScriptsPath .
'/' . $file );
491 $this->splash->incrProgressBar();
495 $this->
writeLog(
'Current app path reg key: ' . $currentAppPathRegKey );
496 $this->
writeLog(
'Gen app path reg key: ' . $genAppPathRegKey );
497 if ( $currentAppPathRegKey != $genAppPathRegKey ) {
499 if ( !empty( $this->error ) ) {
500 $this->error .= PHP_EOL . PHP_EOL;
503 $this->error .= PHP_EOL . $bearsamppRegistry->getLatestError();
506 $this->
writeLog(
'Need restart: checkPathRegKey' );
507 $this->restart =
true;
524 $this->splash->incrProgressBar();
528 $this->
writeLog(
'Current app bins reg key: ' . $currentAppBinsRegKey );
529 $this->
writeLog(
'Gen app bins reg key: ' . $genAppBinsRegKey );
530 if ( $currentAppBinsRegKey != $genAppBinsRegKey ) {
532 if ( !empty( $this->error ) ) {
533 $this->error .= PHP_EOL . PHP_EOL;
536 $this->error .= PHP_EOL . $bearsamppRegistry->getLatestError();
539 $this->
writeLog(
'Need restart: checkBinsRegKey' );
540 $this->restart =
true;
557 $this->splash->incrProgressBar();
560 $this->
writeLog(
'Current system PATH: ' . $currentSysPathRegKey );
565 $this->
writeLog(
'New system PATH: ' . $newSysPathRegKey );
567 if ( $currentSysPathRegKey != $newSysPathRegKey ) {
569 if ( !empty( $this->error ) ) {
570 $this->error .= PHP_EOL . PHP_EOL;
573 $this->error .= PHP_EOL . $bearsamppRegistry->getLatestError();
576 $this->
writeLog(
'Need restart: checkSystemPathRegKey' );
577 $this->restart =
true;
581 $this->
writeLog(
'Refresh system PATH: ' . $currentSysPathRegKey );
628 if ( !$this->restart ) {
632 $serviceRestart =
false;
633 $serviceAlreadyInstalled =
false;
634 $serviceToRemove =
false;
637 $syntaxCheckCmd =
null;
680 $name = $bin->getName() .
' ' . $bin->getVersion() .
' (' . $service->getName() .
')';
682 $this->splash->incrProgressBar();
684 $serviceInfos = $service->infos();
685 if ( $serviceInfos !==
false ) {
686 $serviceAlreadyInstalled =
true;
687 $this->
writeLog( $name .
' service already installed' );
688 foreach ( $serviceInfos as $key => $value ) {
689 $this->
writeLog(
'-> ' . $key .
': ' . $value );
691 $serviceGenPathName = trim( str_replace(
'"',
'', $service->getBinPath() . ($service->getParams() ?
' ' . $service->getParams() :
'') ) );
693 if ( $serviceGenPathName != $serviceVbsPathName ) {
694 $serviceToRemove =
true;
695 $this->
writeLog( $name .
' service has to be removed' );
696 $this->
writeLog(
'-> serviceGenPathName: ' . $serviceGenPathName );
697 $this->
writeLog(
'-> serviceVbsPathName: ' . $serviceVbsPathName );
701 $this->splash->incrProgressBar();
702 if ( $serviceToRemove && !$service->delete() ) {
703 $serviceRestart =
true;
706 if ( !$serviceRestart ) {
708 if ( $isPortInUse ===
false ) {
709 $this->splash->incrProgressBar();
710 if ( !$serviceAlreadyInstalled && !$serviceToRemove ) {
712 if ( !$service->create() ) {
717 $this->splash->incrProgressBar();
719 if ( !$service->start() ) {
720 if ( !empty( $serviceError ) ) {
721 $serviceError .= PHP_EOL;
724 if ( !empty( $syntaxCheckCmd ) ) {
725 $cmdSyntaxCheck = $bin->getCmdLineOutput( $syntaxCheckCmd );
726 if ( !$cmdSyntaxCheck[
'syntaxOk'] ) {
731 $this->splash->incrProgressBar();
734 if ( !empty( $serviceError ) ) {
735 $serviceError .= PHP_EOL;
738 $this->splash->incrProgressBar( 3 );
742 $this->
writeLog(
'Need restart: installService ' . $bin->getName() );
743 $this->restart =
true;
744 $this->splash->incrProgressBar( 3 );
747 if ( !empty( $serviceError ) ) {
748 if ( !empty( $this->error ) ) {
749 $this->error .= PHP_EOL . PHP_EOL;
759 $this->splash->incrProgressBar( self::GAUGE_SERVICES * count(
$bearsamppBins->getServices() ) );