return false early from directory resource
This commit is contained in:
parent
f7ba71db7c
commit
96107e21f1
@ -68,7 +68,10 @@ class DirectoryResource implements ResourceInterface, \Serializable
|
||||
return false;
|
||||
}
|
||||
|
||||
$newestMTime = filemtime($this->resource);
|
||||
if ($timestamp <= filemtime($this->resource)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->resource), \RecursiveIteratorIterator::SELF_FIRST) as $file) {
|
||||
// if regex filtering is enabled only check matching files
|
||||
if ($this->pattern && $file->isFile() && !preg_match($this->pattern, $file->getBasename())) {
|
||||
@ -81,10 +84,13 @@ class DirectoryResource implements ResourceInterface, \Serializable
|
||||
continue;
|
||||
}
|
||||
|
||||
$newestMTime = max($file->getMTime(), $newestMTime);
|
||||
// early return if a file's mtime exceeds the passed timestamp
|
||||
if ($timestamp <= $file->getMTime()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $newestMTime < $timestamp;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function serialize()
|
||||
|
Reference in New Issue
Block a user