|
|
@@ -93,35 +93,45 @@ class maj {
|
|
|
}
|
|
|
|
|
|
if($gitReturn == TRUE){
|
|
|
- $sql = maj::readFileSQL();
|
|
|
|
|
|
- if($sql != NULL){
|
|
|
- $sqlReturn = maj::query($sql);
|
|
|
- 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"
|
|
|
- ));
|
|
|
+ $tmpMajSQL = md5(DIR_MAJ . "sql/maj.sql");
|
|
|
+
|
|
|
+ if($tmpMajSQL != core::getConfig("LAST_MD5_MYSQL")) {
|
|
|
+ $sql = maj::readFileSQL();
|
|
|
+
|
|
|
+ if($sql != NULL){
|
|
|
+ $sqlReturn = maj::query($sql);
|
|
|
+ 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 {
|
|
|
+ core::updateConfig("LAST_MD5_MYSQL", $tmpMajSQL);
|
|
|
+ self::printSeparateur();
|
|
|
+ self::print("La mise à jour de la base de données s'est correctement réalisée", self::$colorLineGrey);
|
|
|
+ }
|
|
|
} else {
|
|
|
+ $sqlReturn = TRUE;
|
|
|
self::printSeparateur();
|
|
|
- self::print("La mise à jour de la base de données s'est correctement réalisée", self::$colorLineGrey);
|
|
|
+ self::print("Pas de Maj SQL à réaliser", self::$colorLineGrey);
|
|
|
}
|
|
|
} else {
|
|
|
$sqlReturn = TRUE;
|
|
|
self::printSeparateur();
|
|
|
- self::print("Pas de Maj SQL à réaliser", self::$colorLineGrey);
|
|
|
- }
|
|
|
+ self::print("Le fichier maj.sql a déjà été exécuté et a été ignoré.", self::$colorLineOrange);
|
|
|
+ }
|
|
|
|
|
|
self::printSeparateur();
|
|
|
self::print(">> Réinitialisation des JSON", self::$colorLineGrey);
|
|
|
@@ -137,6 +147,7 @@ class maj {
|
|
|
json::create("banque-lignes-3");
|
|
|
json::create("banque-lignes-4");
|
|
|
json::create("banque-csv");
|
|
|
+ json::create("documents");
|
|
|
}
|
|
|
|
|
|
self::printSeparateur();
|