Explorar el Código

added upgrade encrypted source info to Install route

Piotr Labudda hace 10 años
padre
commit
a8df4cd4b7
Se han modificado 1 ficheros con 26 adiciones y 8 borrados
  1. 26 8
      SE/se-lib/Route/Install.php

+ 26 - 8
SE/se-lib/Route/Install.php

@@ -63,6 +63,7 @@ jQuery(document).ready(function () {
 			$this->_endWithException($e);
 		}
 		//$this->generateApp($args['licence_id']);
+		//DBG::_(true, true, "appLicenceInfo", $appLicenceInfo, __CLASS__, __FUNCTION__, __LINE__);
 ?>
 <div class="jumbotron">
   <div class="container">
@@ -83,18 +84,19 @@ jQuery(document).ready(function () {
 				Katalog istnieje i zawiera już repozytorium git:
 				<br> - <a href="index.php?_route=Install&_task=gitResetHard&licence_id=<?php echo $appLicenceInfo->ID; ?>"
 					 target="_blank"
-					 class="btn btn-xs btn-default">aktualizuj werjsę (git reset --hard, git pull, set SE/VERSION)</a>
+					 class="btn btn-xs btn-default">aktualizuj werjsę</a> (git reset --hard, git pull, set SE/VERSION - tak samo co 'rm -rf; git clone', ale szybciej)
 				<br> - <a href="index.php?_route=Install&_task=encodeSource&licence_id=<?php echo $appLicenceInfo->ID; ?>"
 					 target="_blank"
 					 class="btn btn-xs btn-default">encode files</a>
-				<br> send files:
+				<br> TODO: send files:
 				<pre>
-					ssh server@biuro.galeriaprzymorze.eu 'rm -rf ~/se.encrypted.upgrade/SE'
-					# scp -r SE server@biuro.galeriaprzymorze.eu:~/se.encrypted.upgrade/
-					rsync --archive --verbose --update --times --compress --one-file-system --omit-dir-times --no-g --no-perms SE/ server@biuro.galeriaprzymorze.eu:~/se.encrypted.upgrade/SE/
-					ssh server@biuro.galeriaprzymorze.eu 'ln -s /Library/Server/Web/Data/Sites/Default/SE/config ~/se.encrypted.upgrade/SE/config'
-					ssh server@biuro.galeriaprzymorze.eu 'ln -s ~/se.encrypted.upgrade/SE /Library/Server/Web/Data/Sites/Default/se.encrypted.upgrade'
-					https://biuro.galeriaprzymorze.eu/se.encrypted.upgrade/
+ssh server@<?php echo $appLicenceInfo->mainServer; ?> 'rm -rf ~/se.encrypted.upgrade/SE'
+cd '<?php echo $appLicenceInfo->installPath; ?>'
+# scp -r SE server@<?php echo $appLicenceInfo->mainServer; ?>:~/se.encrypted.upgrade/
+rsync --archive --verbose --update --times --compress --one-file-system --omit-dir-times --no-g --no-perms SE/ server@<?php echo $appLicenceInfo->mainServer; ?>:~/se.encrypted.upgrade/SE/
+ssh server@<?php echo $appLicenceInfo->mainServer; ?> 'ln -s /Library/Server/Web/Data/Sites/Default/SE/config ~/se.encrypted.upgrade/SE/config'
+ssh server@<?php echo $appLicenceInfo->mainServer; ?> 'ln -s ~/se.encrypted.upgrade/SE /Library/Server/Web/Data/Sites/Default/se.encrypted.upgrade'
+Test online: <a href="https://<?php echo $appLicenceInfo->mainServer; ?>/se.encrypted.upgrade/">https://<?php echo $appLicenceInfo->mainServer; ?>/se.encrypted.upgrade/</a>
 				</pre>
 				</ul>
 			</div>
@@ -259,6 +261,7 @@ jQuery(document).ready(function () {
 		//DBG::_(true, true, 'idLicence', $idLicence, __CLASS__, __FUNCTION__, __LINE__);
 		$appLicenceInfo = new stdClass();
 		$appLicenceInfo->ID = $idLicence;
+		$appLicenceInfo->mainServer = $this->fetchMainServerByLicenceId($idLicence);
 		$appLicenceInfo->domains = $this->fetchDomainsByLicenceId($idLicence);
 		$installRootPath = '/Library/Server/Web/Data/Sites/Default/PLIKI/SES_PROCESY5_A';
 		$appLicenceInfo->installFolderName = "{$idLicence}_upgrade_SE_source_encrypted";
@@ -348,6 +351,21 @@ jQuery(document).ready(function () {
 		return $domains;
 	}
 
+	public function fetchMainServerByLicenceId($licenceId) {
+		$mainServer = null;
+		$db = DB::getDB();
+		$sql = "select g.`SERVER_ADDRESS`
+			from `SES_PROCESY5_A` g
+			where g.`ID`='{$licenceId}'
+			-- TODO: and g.`A_STATUS` in('NORMAL','WAITING')
+		";
+		$res = $db->query($sql);
+		while ($r = $db->fetch($res)) {
+			$mainServer = $r->SERVER_ADDRESS;
+		}
+		return $mainServer;
+	}
+
 	public function _endWithException($e) {
 ?>
 <div class="container">