|
@@ -5,21 +5,21 @@ class maj {
|
|
|
private static $colorLineGrey = "#6c757d";
|
|
private static $colorLineGrey = "#6c757d";
|
|
|
private static $colorLineRed = "red";
|
|
private static $colorLineRed = "red";
|
|
|
private static $colorLineOrange = "orange";
|
|
private static $colorLineOrange = "orange";
|
|
|
|
|
+
|
|
|
|
|
+ public static function readFileSQL(){
|
|
|
|
|
+ return file_get_contents(DIR_MAJ . "sql/maj.sql");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
public static function query(string $query = NULL){
|
|
public static function query(string $query = NULL){
|
|
|
if($query != NULL){
|
|
if($query != NULL){
|
|
|
db::query($query);
|
|
db::query($query);
|
|
|
try {
|
|
try {
|
|
|
db::execute();
|
|
db::execute();
|
|
|
- maj::print("SUCCESS : " . $query, self::$colorLineGrey);
|
|
|
|
|
return TRUE;
|
|
return TRUE;
|
|
|
} catch (Exception $ex) {
|
|
} catch (Exception $ex) {
|
|
|
maj::print("ERREUR TECHNIQUE : " . $query, self::$colorLineRed);
|
|
maj::print("ERREUR TECHNIQUE : " . $query, self::$colorLineRed);
|
|
|
return FALSE;
|
|
return FALSE;
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
- maj::print("ERREUR TECHNIQUE : Query not found", self::$colorLineRed);
|
|
|
|
|
- return FALSE;
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -93,28 +93,34 @@ class maj {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if($gitReturn == TRUE){
|
|
if($gitReturn == TRUE){
|
|
|
- include_once(DIR_MAJ . "sql/maj.php");
|
|
|
|
|
- $sqlReturn = goSql();
|
|
|
|
|
- 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"
|
|
|
|
|
- ));
|
|
|
|
|
|
|
+ $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 {
|
|
|
|
|
+ self::printSeparateur();
|
|
|
|
|
+ self::print("Maj SQL réalisée", self::$colorLineGrey);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
self::printSeparateur();
|
|
self::printSeparateur();
|
|
|
- self::print("Maj SQL réalisée", self::$colorLineGrey);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ self::print("Pas de Maj SQL à réaliser", self::$colorLineGrey);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
self::printSeparateur();
|
|
self::printSeparateur();
|
|
|
self::print(">> Réinitialisation des JSON", self::$colorLineGrey);
|
|
self::print(">> Réinitialisation des JSON", self::$colorLineGrey);
|
|
@@ -125,6 +131,11 @@ class maj {
|
|
|
json::create("users");
|
|
json::create("users");
|
|
|
json::create("salaries-proweb");
|
|
json::create("salaries-proweb");
|
|
|
json::create("lotterys");
|
|
json::create("lotterys");
|
|
|
|
|
+ json::create("banque-lignes-1");
|
|
|
|
|
+ json::create("banque-lignes-1");
|
|
|
|
|
+ json::create("banque-lignes-1");
|
|
|
|
|
+ json::create("banque-lignes-1");
|
|
|
|
|
+ json::create("banque-csv");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
self::printSeparateur();
|
|
self::printSeparateur();
|