ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $version_mini_hash = ilUtil::execQuoted('git rev-parse --short HEAD');
34 $version_number = ilUtil::execQuoted('git rev-list --count HEAD');
35 $line = ilUtil::execQuoted('git log -1');
36
37 if ($version_number[0]) {
38 $version_number = $version_number[0];
39 }
40
41 if ($version_mini_hash[0]) {
42 $version_mini_hash = $version_mini_hash[0];
43 }
44
45 if ($line && array_filter($line)) {
46 $line = implode(' | ', array_filter($line));
47 }
48 } else {
49 $version_mini_hash = trim(exec('git rev-parse --short HEAD'));
50 $version_number = exec('git rev-list --count HEAD');
51 $line = trim(exec('git log -1'));
52 }
53
54 if ($version_number) {
55 $info[] = sprintf($lng->txt('git_revision'), $version_number);
56 }
57
58 if ($version_mini_hash) {
59 $info[] = sprintf($lng->txt('git_hash_short'), $version_mini_hash);
60 }
61
62 if ($line) {
63 $info[] = sprintf($lng->txt('git_last_commit'), $line);
64 }
65
66 self::$revision_information = $info;
67 }
sprintf('%.4f', $callTime)
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
static isWindows()
check wether the current client system is a windows system
$info
Definition: index.php:5
global $lng
Definition: privfeed.php:17
global $DIC
Definition: saml.php:7

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

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 72 of file class.ilGitInformation.php.

73 {
75
76 return implode("<br />", self::$revision_information);
77 }

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: