2
0
stany.ferer 1 жил өмнө
parent
commit
385bd64fdb

+ 22 - 4
core/class/git.class.php

@@ -2,13 +2,31 @@
 
 class git
 {
-    public static function getVersion()
-    {
-        $commitHash = trim(exec('git log --pretty="%h" -n1 HEAD'));
+    public static function getCommitHash(){
+        return substr(trim(exec('git log --pretty="%H" -n1 HEAD')), 0, 10);
+    }
 
+    public static function getCommitDate(){
         $commitDate = new \DateTime(trim(exec('git log -n1 --pretty=%ci HEAD')));
         $commitDate->setTimezone(new \DateTimeZone('UTC'));
+        return $commitDate->format('d/m/Y à H:i:s');
+    }
+
+    public static function getCommitAuthor(){
+        return exec('git log --pretty="%cn" -n1 HEAD');
+    }
+
+    public static function getCommitName(){
+        return exec('git log --pretty="%s" -n1 HEAD');
+    }
 
-        return sprintf('%s (%s)', $commitHash, $commitDate->format('Y-m-d H:i:s'));
+    public static function printVersion(){
+        echo sprintf(
+            '<h6>%s <span class="badge bg-success">%s</h6></div><div>%s (%s)</div>',
+            self::getCommitAuthor(), 
+            self::getCommitHash(),
+            self::getCommitName(),
+            self::getCommitDate()
+        );
     }
 }

+ 2 - 2
core/views/pages/cms.parametres-general.php

@@ -67,9 +67,9 @@
 
 <?php } ?>
 
-    <h4>Infos Git</h4>
+    <h4>Git</h4>
     <div class="element-parametres">
-        <?php echo git::getVersion() ?>
+        <?php git::printVersion() ?>
     </div>
 
 <script>