ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilGitInformation.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Administration/interfaces/interface.ilVersionControlInformation.php';
5
11{
15 private static $revision_information = null;
16
20 private static function detect()
21 {
25 global $lng;
26
27 if(null !== self::$revision_information)
28 {
30 }
31
32 $info = array();
33
34 // https://gist.github.com/reiaguilera/82d164c7211e299d63ac
36 {
37 $version_mini_hash = ilUtil::execQuoted('git describe --always');
38 $version_number = ilUtil::execQuoted('git rev-list HEAD | wc -l');
39 $line = ilUtil::execQuoted('git log -1');
40
41 if($version_number[0])
42 {
43 $version_number = $version_number[0];
44 }
45
46 if($version_mini_hash[0])
47 {
48 $version_mini_hash = $version_mini_hash[0];
49 }
50
51 if($line && array_filter($line))
52 {
53 $line = implode(' | ', array_filter($line));
54 }
55 }
56 else
57 {
58 $version_mini_hash = trim(exec('git describe --always'));
59 $version_number = exec('git rev-list HEAD | find /v /c ""');
60 $line = trim(exec('git log -1'));
61 }
62
63 if($version_number)
64 {
65 $info[] = sprintf($lng->txt('git_revision'), $version_number);
66 }
67
68 if($version_mini_hash)
69 {
70 $info[] = sprintf($lng->txt('git_hash_short'), $version_mini_hash);
71 }
72
73 if($line)
74 {
75 $info[] = sprintf($lng->txt('git_last_commit'), $line);
76 }
77
78 self::$revision_information = $info;
79 }
80
84 public function getInformationAsHtml()
85 {
86 self::detect();
87
88 return implode("<br />", self::$revision_information);
89 }
90}
Class ilGitInformation.
static isWindows()
check wether the current client system is a windows system
static execQuoted($cmd, $args=NULL)
exec command and fix spaces on windows
$info
Definition: example_052.php:80
global $lng
Definition: privfeed.php:40