Skip to content
Permalink
Browse files

πŸ› 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.
  • Loading branch information...
micgro42 committed Jul 5, 2018
1 parent fdbbfed commit 6a381c557fd049a93f2f6a322618a307253f1d77
Showing with 2 additions and 14 deletions.
  1. +2 βˆ’14 inc/infoutils.php
@@ -75,20 +75,8 @@ function getVersionData(){
$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;

0 comments on commit 6a381c5

Please sign in to comment.
You can’t perform that action at this time.