🐛 make getVersion show the commit date, not checkout date

Currently, getVersion() shows the date when the HEAD of the local git
repository was last changed, not the date of the current commit. This
commit fixes that behavior.
This commit is contained in:
Michael Große 2018-07-05 11:13:19 +02:00
parent fdbbfed91f
commit 067b4fb970
No known key found for this signature in database
GPG Key ID: 7E31028FBFEACC79
1 changed files with 2 additions and 15 deletions

View File

@ -74,21 +74,8 @@ function getVersionData(){
$version['type'] = 'Git';
$version['date'] = 'unknown';
$inventory = DOKU_INC.'.git/logs/HEAD';
if(is_file($inventory)){
$sz = filesize($inventory);
$seek = max(0,$sz-2000); // read from back of the file
$fh = fopen($inventory,'rb');
fseek($fh,$seek);
$chunk = fread($fh,2000);
fclose($fh);
$chunk = trim($chunk);
$chunk = @array_pop(explode("\n",$chunk)); //last log line
$chunk = @array_shift(explode("\t",$chunk)); //strip commit msg
$chunk = explode(" ",$chunk);
array_pop($chunk); //strip timezone
$date = date('Y-m-d',array_pop($chunk));
if($date) $version['date'] = $date;
if ($date = shell_exec("git log -1 --pretty=format:'%cd' --date=short")) {
$version['date'] = hsc($date);
}
}else{
global $updateVersion;