ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
35 {
36 $version_mini_hash = ilUtil::execQuoted('git rev-parse --short HEAD');
37 $version_number = ilUtil::execQuoted('git rev-list --count HEAD');
38 $line = ilUtil::execQuoted('git log -1');
39
40 if($version_number[0])
41 {
42 $version_number = $version_number[0];
43 }
44
45 if($version_mini_hash[0])
46 {
47 $version_mini_hash = $version_mini_hash[0];
48 }
49
50 if($line && array_filter($line))
51 {
52 $line = implode(' | ', array_filter($line));
53 }
54 }
55 else
56 {
57 $version_mini_hash = trim(exec('git rev-parse --short HEAD'));
58 $version_number = exec('git rev-list --count HEAD');
59 $line = trim(exec('git log -1'));
60 }
61
62 if($version_number)
63 {
64 $info[] = sprintf($lng->txt('git_revision'), $version_number);
65 }
66
67 if($version_mini_hash)
68 {
69 $info[] = sprintf($lng->txt('git_hash_short'), $version_mini_hash);
70 }
71
72 if($line)
73 {
74 $info[] = sprintf($lng->txt('git_last_commit'), $line);
75 }
76
77 self::$revision_information = $info;
78 }
79
83 public function getInformationAsHtml()
84 {
85 self::detect();
86
87 return implode("<br />", self::$revision_information);
88 }
89}
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
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:17