improve update-time detection
This commit is contained in:
parent
fc28e8c5c8
commit
138a3c3342
26
rebuild.php
26
rebuild.php
@ -192,11 +192,20 @@ class CProject {
|
||||
// Identify resources in folder
|
||||
|
||||
$ls = scandir($this->dir);
|
||||
$found_real_lastupdate = false;
|
||||
foreach($ls as $file) {
|
||||
if ($file[0] == '.') continue;
|
||||
|
||||
if ($file == 'README.txt') {
|
||||
$this->lastupdate = max($this->lastupdate, filectime($this->dir.$file)); // don't count README updates
|
||||
|
||||
// Guess 'last update' time
|
||||
$matches = [];
|
||||
if (preg_match('~\n(\d\d\d\d-\d\d-\d\d)~', $this->longdesc, $matches)) {
|
||||
// Use first date entry (assumed to be a CHANGELOG)
|
||||
$this->lastupdate = strtotime($matches[1]);
|
||||
$found_real_lastupdate = true;
|
||||
|
||||
}
|
||||
|
||||
$this->longdesc = file_get_contents($this->dir.'README.txt');
|
||||
|
||||
@ -234,12 +243,14 @@ class CProject {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->lastupdate = max(
|
||||
$this->lastupdate,
|
||||
// filectime($this->dir.$file),
|
||||
filemtime($this->dir.$file)
|
||||
);
|
||||
|
||||
if (! $found_real_lastupdate) {
|
||||
$this->lastupdate = max(
|
||||
$this->lastupdate,
|
||||
// filectime($this->dir.$file),
|
||||
($file == 'README.txt' ? filectime($this->dir.$file) : filemtime($this->dir.$file)) // Don't count README updates
|
||||
);
|
||||
}
|
||||
|
||||
if (is_image($file)) {
|
||||
$this->images[] = $file;
|
||||
@ -582,6 +593,7 @@ function main($args) {
|
||||
//
|
||||
|
||||
ini_set('display_errors', 'On');
|
||||
date_default_timezone_set('Etc/UTC');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
main(array_slice($_SERVER['argv'], 1));
|
||||
|
Reference in New Issue
Block a user