|
@@ -452,6 +452,29 @@ jQuery(document).ready(function () {
|
|
|
SE_Layout::dol();
|
|
SE_Layout::dol();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function _fetchRemoteHomeDir($appLicenceInfo) {
|
|
|
|
|
+ $this->_assertRsaKeyExists($appLicenceInfo);
|
|
|
|
|
+ $sshHostUsr = "{$appLicenceInfo->rootLogin}@{$appLicenceInfo->mainServer}";
|
|
|
|
|
+ $sshArgs = (22 != $appLicenceInfo->sshPort)? "-p {$appLicenceInfo->sshPort}" : '';
|
|
|
|
|
+ $rsyncSshPort = (22 != $appLicenceInfo->sshPort)? "-e 'ssh -p {$appLicenceInfo->sshPort}'" : '';
|
|
|
|
|
+
|
|
|
|
|
+ if (V::get('DBG_REMOTE', '', $_GET)) {// DBG
|
|
|
|
|
+ $cmd = "echo ~";
|
|
|
|
|
+ V::exec("ssh {$sshArgs} {$sshHostUsr} '{$cmd}'", $out, $ret);
|
|
|
|
|
+ DBG::_(true, true, "exec(ssh ... 'cmd'): {$cmd} (return: {$ret})", $out, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
|
|
+ V::execRemote($appLicenceInfo->mainServer, $appLicenceInfo->rootLogin, $appLicenceInfo->rootPassword, $cmd, $out, $ret, $appLicenceInfo->sshPort);
|
|
|
|
|
+ DBG::_(true, true, "execRemote(cmd): {$cmd} (return: {$ret})", $out, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
|
|
+ V::execRootRemote($appLicenceInfo->mainServer, $appLicenceInfo->rootLogin, $appLicenceInfo->rootPassword, $cmd, $out, $ret, $appLicenceInfo->sshPort);
|
|
|
|
|
+ DBG::_(true, true, "execRootRemote(cmd): {$cmd} (return: {$ret})", $out, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $cmd = "echo ~";
|
|
|
|
|
+ V::exec("ssh {$sshArgs} {$sshHostUsr} '{$cmd}'", $out, $ret);
|
|
|
|
|
+ DBG::_(true, true, "exec(ssh ... '{$cmd}') (return: {$ret})", $out, __CLASS__, __FUNCTION__, __LINE__);
|
|
|
|
|
+ if (empty($out) || empty($out[0])) throw new Exception("Cannot fetch remote home dir");
|
|
|
|
|
+ return $out[0];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function _sendToRemoteTestDir($appLicenceInfo) {
|
|
public function _sendToRemoteTestDir($appLicenceInfo) {
|
|
|
$cmd = ''; $out = ''; $ret = '';
|
|
$cmd = ''; $out = ''; $ret = '';
|
|
|
|
|
|
|
@@ -467,6 +490,8 @@ jQuery(document).ready(function () {
|
|
|
-t, --times preserve times
|
|
-t, --times preserve times
|
|
|
--delete delete extraneous files from dest dirs
|
|
--delete delete extraneous files from dest dirs
|
|
|
*/
|
|
*/
|
|
|
|
|
+ DBG::_(true, true, "remote home dir:", $this->_fetchRemoteHomeDir($appLicenceInfo), __CLASS__, __FUNCTION__, __LINE__);
|
|
|
|
|
+
|
|
|
$cmd = "
|
|
$cmd = "
|
|
|
ssh {$sshArgs} {$sshHostUsr} '[ ! -d ~/se.encrypted.upgrade ] && mkdir ~/se.encrypted.upgrade || echo 1';
|
|
ssh {$sshArgs} {$sshHostUsr} '[ ! -d ~/se.encrypted.upgrade ] && mkdir ~/se.encrypted.upgrade || echo 1';
|
|
|
ssh {$sshArgs} {$sshHostUsr} 'rm -rf ~/se.encrypted.upgrade/SE';
|
|
ssh {$sshArgs} {$sshHostUsr} 'rm -rf ~/se.encrypted.upgrade/SE';
|
|
@@ -514,7 +539,8 @@ ssh {$sshArgs} {$sshHostUsr} 'ln -s ~/se.encrypted.upgrade/SE /Library/Server/We
|
|
|
$this->_assertRsaKeyExists($appLicenceInfo);
|
|
$this->_assertRsaKeyExists($appLicenceInfo);
|
|
|
|
|
|
|
|
$dateStr = date("Y-m-d_H-i-s");
|
|
$dateStr = date("Y-m-d_H-i-s");
|
|
|
- $remoteHomeDir = "/Users/{$appLicenceInfo->rootLogin}";
|
|
|
|
|
|
|
+ // $remoteHomeDir = "/Users/{$appLicenceInfo->rootLogin}";// BUG: alias like in ams - login = prezes is alias for arkadiuszbinder
|
|
|
|
|
+ $remoteHomeDir = $this->_fetchRemoteHomeDir($appLicenceInfo);
|
|
|
$cmd = "
|
|
$cmd = "
|
|
|
rm -rf /Library/Server/Web/Data/Sites/Default/SE.test 2>&1
|
|
rm -rf /Library/Server/Web/Data/Sites/Default/SE.test 2>&1
|
|
|
cp -r {$remoteHomeDir}/se.encrypted.upgrade/SE /Library/Server/Web/Data/Sites/Default/SE.test 2>&1
|
|
cp -r {$remoteHomeDir}/se.encrypted.upgrade/SE /Library/Server/Web/Data/Sites/Default/SE.test 2>&1
|