Skip to content

Commit f0adc7e

Browse files
Merge branch '3.2'
* 3.2: (27 commits) Improve tracking of environment variables in the case of private services [DI] Align AutowirePass with 2.8 property constraints can be added in child classes added test for staticClassLoader in LazyLoadingMetadatafactory fixed PHPUnit setUp and tearDown method visibility spelling fixes Readd Symfony version status in the toolbar [Security] LdapUserProvider should not throw an exception if the UID key does not exist in an LDAP entry make sure that null can be the invalid value [VarDumper] Improve dump of AMQP* Object Fix annotations cache folder path [FrameworkBundle] Wire ArrayCache for annotation reader at bootstrap Ignore missing 'debug.file_link_formatter' service in Debug bundle [VarDumper] Fixed dumping of terminated generator bumped Symfony version to 3.2.4 updated VERSION for 3.2.3 updated CHANGELOG for 3.2.3 bumped Symfony version to 2.8.18 updated VERSION for 2.8.17 updated CHANGELOG for 2.8.17 ...
2 parents 94e428b + 9f99453 commit f0adc7e

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Resource/DirectoryResource.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ public function isFresh($timestamp)
7474
return false;
7575
}
7676

77-
$newestMTime = filemtime($this->resource);
77+
if ($timestamp < filemtime($this->resource)) {
78+
return false;
79+
}
80+
7881
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->resource), \RecursiveIteratorIterator::SELF_FIRST) as $file) {
7982
// if regex filtering is enabled only check matching files
8083
if ($this->pattern && $file->isFile() && !preg_match($this->pattern, $file->getBasename())) {
@@ -87,10 +90,13 @@ public function isFresh($timestamp)
8790
continue;
8891
}
8992

90-
$newestMTime = max($file->getMTime(), $newestMTime);
93+
// early return if a file's mtime exceeds the passed timestamp
94+
if ($timestamp < $file->getMTime()) {
95+
return false;
96+
}
9197
}
9298

93-
return $newestMTime < $timestamp;
99+
return true;
94100
}
95101

96102
public function serialize()

Tests/Resource/DirectoryResourceTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ public function testIsFreshNewFileWithDifferentPattern()
110110
public function testIsFreshDeleteFile()
111111
{
112112
$resource = new DirectoryResource($this->directory);
113+
$time = time();
114+
sleep(1);
113115
unlink($this->directory.'/tmp.xml');
114-
$this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if an existing file is removed');
116+
$this->assertFalse($resource->isFresh($time), '->isFresh() returns false if an existing file is removed');
115117
}
116118

117119
public function testIsFreshDeleteDirectory()

0 commit comments

Comments
 (0)