stany.ferer 1 anno fa
parent
commit
2e9874bc20
1 ha cambiato i file con 37 aggiunte e 30 eliminazioni
  1. 37 30
      core/class/maj.class.php

+ 37 - 30
core/class/maj.class.php

@@ -67,7 +67,11 @@ class maj {
         backup::create();
         file::cleanFilesByOrder(DIR_BACKUP, BACKUP_LIMIT);
 
-        if(self::bashMaj() == FALSE){
+
+        // Git
+        $gitReturn = self::bashMaj();
+
+        if($gitReturn == FALSE){
             self::printSeparateur();
             self::print("ERROR : Repo GIT [" . MAJ_TARGET . " - " . git::getCommitHash(MAJ_TARGET) . "]", self::$colorLineRed);
             self::printSeparateur();
@@ -88,38 +92,41 @@ class maj {
             self::print("Mise à jour du repo GIT [" . MAJ_TARGET . " - " . git::getCommitHash(MAJ_TARGET) . "] effectué", self::$colorLineGrey);
         }
 
-        include_once(DIR_MAJ . "sql/maj.php");
-        if(goSql() == FALSE){
-            self::printSeparateur();
-            self::print("ERROR : Maj SQL", self::$colorLineRed);
-            self::printSeparateur();
-            self::print(">> ROLLBACK : Restauration des données", self::$colorLineOrange);
-            backup::restore(DIR_BACKUP . backup::last());
-
-            alert::recError("ERROR : Maj SQL");
+        if($gitReturn == TRUE){
+            $sqlReturn = goSql();
+            include_once(DIR_MAJ . "sql/maj.php");
+            if($sqlReturn == FALSE){
+                self::printSeparateur();
+                self::print("ERROR : Maj SQL", self::$colorLineRed);
+                self::printSeparateur();
+                self::print(">> ROLLBACK : Restauration des données", self::$colorLineOrange);
+                backup::restore(DIR_BACKUP . backup::last());
+
+                alert::recError("ERROR : Maj SQL");
+
+                historique::recRef("/parametres.html");
+                historique::add(array(
+                    "idType" => historique::getIdRef("ERROR"),
+                    "idUser" => session::getId(),
+                    "idPage" => historique::getIdRef("/parametres.html"),
+                    "log" => "ERROR : Maj SQL"
+                ));
+            } else {
+                self::printSeparateur();
+                self::print("Maj SQL réalisée", self::$colorLineGrey);
+            }
 
-            historique::recRef("/parametres.html");
-            historique::add(array(
-                "idType" => historique::getIdRef("ERROR"),
-                "idUser" => session::getId(),
-                "idPage" => historique::getIdRef("/parametres.html"),
-                "log" => "ERROR : Maj SQL"
-            ));
-        } else {
             self::printSeparateur();
-            self::print("Maj SQL réalisée", self::$colorLineGrey);
+            self::print(">> Réinitialisation des JSON", self::$colorLineGrey);
+            json::create("salaries");
+            json::create("excel");
+            json::create("excel-proweb");
+            json::create("events");
+            json::create("users");
+            json::create("salaries-proweb");
+            json::create("lotterys");
         }
 
-        self::printSeparateur();
-        self::print(">> Réinitialisation des JSON", self::$colorLineGrey);
-        json::create("salaries");
-        json::create("excel");
-        json::create("excel-proweb");
-        json::create("events");
-        json::create("users");
-        json::create("salaries-proweb");
-        json::create("lotterys");
-
         self::printSeparateur();
         self::print(">> Mode maintenance désactivé", self::$colorLineGrey);
         core::removeFileMaintenance();
@@ -128,7 +135,7 @@ class maj {
         self::print(">> Fin de la mise à jour de " . DOMAIN_CMS, self::$colorLineGrey);
         self::printSeparateur();
 
-        if($gitReturn == TRUE){
+        if($gitReturn == TRUE AND $sqlReturn == TRUE){
             historique::recRef("/parametres.html");
             historique::add(array(
                 "idType" => historique::getIdRef("ACTION"),