🐛 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:
parent
fdbbfed91f
commit
067b4fb970
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue