|
@@ -957,25 +957,23 @@ jQuery(document).ready(function () {
|
|
|
DBG::log($remoteDir, 'array', "remote home dir:");
|
|
DBG::log($remoteDir, 'array', "remote home dir:");
|
|
|
|
|
|
|
|
$listCmd = [];
|
|
$listCmd = [];
|
|
|
- $listCmd[] = " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} '[ ! -d ~/se.encrypted.upgrade ] && mkdir ~/se.encrypted.upgrade || echo 1' ";
|
|
|
|
|
- $listCmd[] = " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'rm -rf ~/se.encrypted.upgrade/SE' ";
|
|
|
|
|
- $listCmd[] = " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'cp -p -r /Library/Server/Web/Data/Sites/Default/SE ~/se.encrypted.upgrade/SE' ";
|
|
|
|
|
- $listCmd[] = " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'rm -rf ~/se.encrypted.upgrade/SE/config' ";
|
|
|
|
|
- $listCmd[] = "
|
|
|
|
|
-rsync --recursive --links -D --times --delete --compress --one-file-system --omit-dir-times --no-g --no-perms {$dryRunOnly} \
|
|
|
|
|
- --verbose {$rsyncSshPort} \
|
|
|
|
|
- --exclude='schema/default_db.instance.xml' \
|
|
|
|
|
- --exclude='schema/default_db.instance.xml/**' \
|
|
|
|
|
- '{$appLicenceInfo->installPath}/SE/' {$sshHostUsr}:~/se.encrypted.upgrade/SE/
|
|
|
|
|
- ";
|
|
|
|
|
- $listCmd[] = " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'cp -r /Library/Server/Web/Data/Sites/Default/SE/config ~/se.encrypted.upgrade/SE/' ";
|
|
|
|
|
- $listCmd[] = " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'rm /Library/Server/Web/Data/Sites/Default/se.encrypted.upgrade' ";
|
|
|
|
|
- $listCmd[] = " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'ln -s ~/se.encrypted.upgrade/SE /Library/Server/Web/Data/Sites/Default/se.encrypted.upgrade' ";
|
|
|
|
|
- $listCmd[] = " scp {$this->sshArgsSkipHostKey} {$scpArgs} /Library/Server/Web/Data/Sites/SE-production-git/SE/config/.config_base_structure.php {$sshHostUsr}: ";
|
|
|
|
|
- $listCmd[] = " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'mv ~/.config_base_structure.php /Library/Server/Web/Data/Sites/Default/se.encrypted.upgrade/config' ";
|
|
|
|
|
-
|
|
|
|
|
- $listRootCmd = [];
|
|
|
|
|
- $listRootCmd[] = " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'cp /Users/server/se.encrypted.upgrade/SE/stuff/SourceGuardian/Loaders/Mac\ OS\ X/ixed.5.6.dar /opt/local/lib/php56/extensions/no-debug-non-zts-20131226/' ";
|
|
|
|
|
|
|
+ $listCmd[] = ['user', " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} '[ ! -d ~/se.encrypted.upgrade ] && mkdir ~/se.encrypted.upgrade || echo 1' "];
|
|
|
|
|
+ $listCmd[] = ['root', " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'rm -rf /Users/{$appLicenceInfo->rootLogin}/se.encrypted.upgrade/SE' "];
|
|
|
|
|
+ $listCmd[] = ['user', " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'cp -p -r /Library/Server/Web/Data/Sites/Default/SE ~/se.encrypted.upgrade/SE' "];
|
|
|
|
|
+ $listCmd[] = ['root', " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'chown -R {$appLicenceInfo->rootLogin} /Users/{$appLicenceInfo->rootLogin}/se.encrypted.upgrade' "];
|
|
|
|
|
+ $listCmd[] = ['user', " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'rm -rf ~/se.encrypted.upgrade/SE/config' "];
|
|
|
|
|
+ $listCmd[] = ['user', " rsync --recursive --links -D --times --delete --compress --one-file-system --omit-dir-times --no-g --no-perms {$dryRunOnly} \
|
|
|
|
|
+ --verbose {$rsyncSshPort} \
|
|
|
|
|
+ --exclude='schema/default_db.instance.xml' \
|
|
|
|
|
+ --exclude='schema/default_db.instance.xml/**' \
|
|
|
|
|
+ '{$appLicenceInfo->installPath}/SE/' {$sshHostUsr}:~/se.encrypted.upgrade/SE/
|
|
|
|
|
+ "];
|
|
|
|
|
+ $listCmd[] = ['user', " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'cp -r /Library/Server/Web/Data/Sites/Default/SE/config ~/se.encrypted.upgrade/SE/' "];
|
|
|
|
|
+ $listCmd[] = ['user', " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'rm /Library/Server/Web/Data/Sites/Default/se.encrypted.upgrade' "];
|
|
|
|
|
+ $listCmd[] = ['user', " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'ln -s ~/se.encrypted.upgrade/SE /Library/Server/Web/Data/Sites/Default/se.encrypted.upgrade' "];
|
|
|
|
|
+ $listCmd[] = ['user', " scp {$this->sshArgsSkipHostKey} {$scpArgs} /Library/Server/Web/Data/Sites/SE-production-git/SE/config/.config_base_structure.php {$sshHostUsr}: "];
|
|
|
|
|
+ $listCmd[] = ['user', " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'mv ~/.config_base_structure.php /Library/Server/Web/Data/Sites/Default/se.encrypted.upgrade/config' "];
|
|
|
|
|
+ $listCmd[] = ['root', " ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'cp /Users/server/se.encrypted.upgrade/SE/stuff/SourceGuardian/Loaders/Mac\ OS\ X/ixed.5.6.dar /opt/local/lib/php56/extensions/no-debug-non-zts-20131226/' "];
|
|
|
// "; //todo rsync ... -e \"{$this->sshArgsSkipHostKey}\" - maybe not working
|
|
// "; //todo rsync ... -e \"{$this->sshArgsSkipHostKey}\" - maybe not working
|
|
|
// --exclude='schema/default_db_xml_cache.public' \
|
|
// --exclude='schema/default_db_xml_cache.public' \
|
|
|
// --exclude='stuff' \
|
|
// --exclude='stuff' \
|
|
@@ -983,15 +981,20 @@ rsync --recursive --links -D --times --delete --compress --one-file-system --omi
|
|
|
//--exclude='schema/default_db_xml_cache.public/**' \
|
|
//--exclude='schema/default_db_xml_cache.public/**' \
|
|
|
//TODO @2018-02-09 - check if ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'cp /Applications/SourceGuardian.app/Contents/MacOS/Loaders/Mac\ OS\ X/ixed.5.6.dar /opt/local/lib/php56/extensions/no-debug-non-zts-20131226/'
|
|
//TODO @2018-02-09 - check if ssh {$sshArgs} {$this->sshArgsSkipHostKey} {$sshHostUsr} 'cp /Applications/SourceGuardian.app/Contents/MacOS/Loaders/Mac\ OS\ X/ixed.5.6.dar /opt/local/lib/php56/extensions/no-debug-non-zts-20131226/'
|
|
|
//IS WORKING WELL!
|
|
//IS WORKING WELL!
|
|
|
- foreach ($listCmd as $idx => $cmd) {
|
|
|
|
|
- V::exec("{$cmd} 2>&1", $out, $ret);
|
|
|
|
|
- DBG::log([ 'cmd' => $cmd, 'output' => $out ], 'array', "cmd[{$idx}] return: {$ret}");
|
|
|
|
|
- if (0 !== $ret) throw new Exception("Cannot run remote command using rsa key! #{$ret}. cmd: {$cmd} . out: " . implode("\n", $out));
|
|
|
|
|
- }
|
|
|
|
|
- foreach ($listRootCmd as $idx => $rootCmd) {
|
|
|
|
|
- V::execRootRemote($appLicenceInfo->mainServer, $appLicenceInfo->rootLogin, $appLicenceInfo->rootPassword, "{$rootCmd} 2>&1", $out, $ret, $appLicenceInfo->sshPort);
|
|
|
|
|
- DBG::log([ 'cmd' => $rootCmd, 'output' => $out ], 'array', "root cmd[{$idx}] return: {$ret}");
|
|
|
|
|
- if (0 !== $ret) throw new Exception("Cannot run remote command using rsa key! #{$ret}. root cmd: {$rootCmd} . out: " . implode("\n", $out));
|
|
|
|
|
|
|
+ foreach ($listCmd as $idx => $action) {
|
|
|
|
|
+ list($who, $cmd) = $action;
|
|
|
|
|
+ switch ($who) {
|
|
|
|
|
+ case 'user': {
|
|
|
|
|
+ V::exec("{$cmd} 2>&1", $out, $ret);
|
|
|
|
|
+ DBG::log([ 'cmd' => $cmd, 'output' => $out ], 'array', "cmd[{$idx}] return: {$ret}");
|
|
|
|
|
+ if (0 !== $ret) throw new Exception("Cannot run remote command using rsa key! #{$ret}. cmd: {$cmd} . out: " . implode("\n", $out));
|
|
|
|
|
+ } break;
|
|
|
|
|
+ case '': {
|
|
|
|
|
+ V::execRootRemote($appLicenceInfo->mainServer, $appLicenceInfo->rootLogin, $appLicenceInfo->rootPassword, "{$cmd} 2>&1", $out, $ret, $appLicenceInfo->sshPort);
|
|
|
|
|
+ DBG::log([ 'cmd' => $cmd, 'output' => $out ], 'array', "root cmd[{$idx}] return: {$ret}");
|
|
|
|
|
+ if (0 !== $ret) throw new Exception("Cannot run remote command using rsa key! #{$ret}. root cmd: {$cmd} . out: " . implode("\n", $out));
|
|
|
|
|
+ } break;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|