Filesystem::touch() not working with different owners (utime/atime issue)

This commit is contained in:
Iltar van der Berg 2013-01-04 12:28:25 +01:00 committed by Fabien Potencier
parent 499c9e6fdc
commit 06e21fff03
1 changed files with 2 additions and 5 deletions

View File

@ -100,12 +100,9 @@ class Filesystem
*/ */
public function touch($files, $time = null, $atime = null) public function touch($files, $time = null, $atime = null)
{ {
if (null === $time) {
$time = time();
}
foreach ($this->toIterator($files) as $file) { foreach ($this->toIterator($files) as $file) {
if (true !== @touch($file, $time, $atime)) { $touch = $time ? @touch($file, $time, $atime) : @touch($file);
if (true !== $touch) {
throw new IOException(sprintf('Failed to touch %s', $file)); throw new IOException(sprintf('Failed to touch %s', $file));
} }
} }