Преглед изворни кода

udpated Install - set projects config

Piotr Labudda пре 8 година
родитељ
комит
7ea1b64c2e
1 измењених фајлова са 13 додато и 6 уклоњено
  1. 13 6
      SE/se-lib/Route/Install.php

+ 13 - 6
SE/se-lib/Route/Install.php

@@ -150,8 +150,7 @@ jQuery(document).ready(function () {
 				$idLicence = V::get('licence_id', 0, $_POST, 'int');
 				$appLicenceInfo = $this->getAppLicenceInfo($idLicence);
 				$this->validateAppLicenceInfo($appLicenceInfo);
-				$projects = [ 'bravecare' ]; // TODO: fetch from $appLicenceInfo->projects = [ ... ]
-				$this->gitResetHard($appLicenceInfo->installPath, $projects);
+				$this->gitResetHard($appLicenceInfo->installPath, $appLicenceInfo->projects);
 				flush();
 				$this->_encodeSource($appLicenceInfo->installPath, $appLicenceInfo->domains);
 				flush();
@@ -263,8 +262,7 @@ jQuery(document).ready(function () {
 			$this->validateAppLicenceInfo($appLicenceInfo);
 
 			UI::startContainer();
-			$projects = [ 'bravecare' ]; // TODO: fetch from $appLicenceInfo->projects = [ ... ]
-			$this->gitResetHard($appLicenceInfo->installPath, $projects);
+			$this->gitResetHard($appLicenceInfo->installPath, $appLicenceInfo->projects);
 			UI::endContainer();
 		} catch (Exception $e) {
 			$this->_endWithException($e);
@@ -443,6 +441,14 @@ jQuery(document).ready(function () {
 		if (empty($appLicenceInfo->domains)) throw new Exception("Domains not found."); // TODO: mv to validate
 		$appLicenceInfo->installFolderExists = file_exists("{$appLicenceInfo->installPath}/SE");
 		$appLicenceInfo->installFolderGitExists = file_exists("{$appLicenceInfo->installPath}/.git");
+
+		$appLicenceInfo->projects = []; // TODO: get from db
+		if (79 == $idLicence) { // bravecom.procesy5.pl
+			$appLicenceInfo->projects = [ 'bravecare' ];
+		} else if (80 == $idLicence) { // bravecom.yellowgroup.pl
+			$appLicenceInfo->projects = [ 'bocian' ];
+		}
+
 		return $appLicenceInfo;
 	}
 
@@ -797,8 +803,9 @@ chmod 600 ~/.ssh/authorized_keys;
 		$cmds[] = "cd {$installPath} && echo `git show-ref --head|head -1|head -c 8` > SE/VERSION ";
 		// TODO: fetch from DB
 		{
-			$projectName = "bravecare";
-			$cmds[] = "cd {$installPath} && git submodule update --init SE/projects/{$projectName}";
+			foreach ($appLicenceInfo->projects as $projectName) {
+				$cmds[] = "cd {$installPath} && git submodule update --init SE/projects/{$projectName}";
+			}
 		}
 
 		foreach ($cmds as $cmd) {