stany.ferer 1 year ago
parent
commit
c12536b91b
4 changed files with 28 additions and 8 deletions
  1. 1 5
      core/class/git.class.php
  2. 25 2
      core/class/maj.class.php
  3. 1 1
      core/views/pages/cms.parametres.php
  4. 1 0
      maj/get-origin.sh

+ 1 - 5
core/class/git.class.php

@@ -1,11 +1,7 @@
 <?php 
 
 class git
-{
-    public static function fetch(){
-        exec('git fetch --all');
-    }
-    
+{   
     public static function checkError(string $_string = NULL){
         $return = NULL;
         if($_string != NULL){

+ 25 - 2
core/class/maj.class.php

@@ -64,7 +64,7 @@ class maj {
         if(goSql() == TRUE){
             self::print("Maj SQL réalisée");
             self::printSeparateur();
-            $gitReturn = self::bash();
+            $gitReturn = self::bashMaj();
         } else {
             self::print("ERROR : Maj SQL");
         }
@@ -125,7 +125,7 @@ class maj {
         }
     }
 
-    public static function bash(){
+    public static function bashMaj(){
         $output = NULL;
         $retval = NULL;
         $bash = DIR_MAJ . MAJ . ".sh";
@@ -151,4 +151,27 @@ class maj {
         }
     }
 
+    public static function bashFetch(){
+        $output = NULL;
+        $retval = NULL;
+        $bash = DIR_MAJ . "get-origin.sh";
+        $error = 0;
+
+        if(is_file($bash)){
+            try {
+                exec("bash " .$bash, $output, $retval);
+                foreach ($output as $key => $value) {
+                    self::print($value);
+                }
+            } catch (\Throwable $th) {
+                self::print("ERROR : " . $bash);
+                return FALSE;
+            }
+            return ($error == 0)? TRUE : FALSE;
+        } else {
+            self::print("ERROR : " . $bash . " not found");
+            return FALSE;
+        }
+    }
+
 }

+ 1 - 1
core/views/pages/cms.parametres.php

@@ -1,5 +1,5 @@
 <?php
-git::fetch();
+maj::bashFetch();
 $checkMaintenance = core::isMaintenance();
 $checkDebug = core::isDebug();
 ?>

+ 1 - 0
maj/get-origin.sh

@@ -0,0 +1 @@
+git fetch --all