ILIAS  release_7 Revision v7.30-3-g800a261c036
ilGitInformation Class Reference

Class ilGitInformation. More...

+ Inheritance diagram for ilGitInformation:
+ Collaboration diagram for ilGitInformation:

Public Member Functions

 getInformationAsHtml ()
 
 getInformationAsHtml ()
 

Static Private Member Functions

static detect ()
 

Static Private Attributes

static $revision_information = null
 

Detailed Description

Class ilGitInformation.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 10 of file class.ilGitInformation.php.

Member Function Documentation

◆ detect()

static ilGitInformation::detect ( )
staticprivate

Definition at line 20 of file class.ilGitInformation.php.

21 {
22 global $DIC;
23
24 $lng = $DIC->language();
25
26 if (null !== self::$revision_information) {
28 }
29
30 $info = array();
31
32 if (!ilUtil::isWindows()) {
33 $origin = ilUtil::execQuoted('git config --get remote.origin.url');
34 $branch = ilUtil::execQuoted('git rev-parse --abbrev-ref HEAD');
35 $version_mini_hash = ilUtil::execQuoted('git rev-parse --short HEAD');
36 $version_number = ilUtil::execQuoted('git rev-list --count HEAD');
37 $line = ilUtil::execQuoted('git log -1');
38
39 if ($origin[0]) {
40 $origin = $origin[0];
41 }
42
43 if ($branch[0]) {
44 $branch = $branch[0];
45 }
46
47 if ($version_number[0]) {
48 $version_number = $version_number[0];
49 }
50
51 if ($version_mini_hash[0]) {
52 $version_mini_hash = $version_mini_hash[0];
53 }
54
55 if ($line && array_filter($line)) {
56 $line = implode(' | ', array_filter($line));
57 }
58 } else {
59 $origin = trim(exec('git config --get remote.origin.url'));
60 $branch = trim(exec('git rev-parse --abbrev-ref HEAD'));
61 $version_mini_hash = trim(exec('git rev-parse --short HEAD'));
62 $version_number = exec('git rev-list --count HEAD');
63 $line = trim(exec('git log -1'));
64 }
65
66 if ($origin) {
67 $info[] = $origin;
68 }
69
70 if ($branch) {
71 $info[] = $branch;
72 }
73
74 if ($version_number) {
75 $info[] = sprintf($lng->txt('git_revision'), $version_number);
76 }
77
78 if ($version_mini_hash) {
79 $info[] = sprintf($lng->txt('git_hash_short'), $version_mini_hash);
80 }
81
82 if ($line) {
83 $info[] = sprintf($lng->txt('git_last_commit'), $line);
84 }
85
86 self::$revision_information = $info;
87 }
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
static isWindows()
check wether the current client system is a windows system
global $DIC
Definition: goto.php:24
$lng

References $DIC, $lng, $revision_information, ilUtil\execQuoted(), and ilUtil\isWindows().

Referenced by getInformationAsHtml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInformationAsHtml()

ilGitInformation::getInformationAsHtml ( )
Returns
string

Implements ilVersionControlInformation.

Definition at line 92 of file class.ilGitInformation.php.

93 {
95
96 return implode("<br />", self::$revision_information);
97 }

References detect().

+ Here is the call graph for this function:

Field Documentation

◆ $revision_information

ilGitInformation::$revision_information = null
staticprivate

Definition at line 15 of file class.ilGitInformation.php.

Referenced by detect().


The documentation for this class was generated from the following file: