added @ to all chmod() calls to avoid PHP warnings (operation not permitted) when using CIFS or NTFSa (closes #2125)

This commit is contained in:
Fabien Potencier 2012-05-15 08:43:47 +02:00
parent 6bcdd321e6
commit 982c369f37
7 changed files with 9 additions and 9 deletions

View File

@ -182,7 +182,7 @@ class ClassCollectionLoader
{
$tmpFile = tempnam(dirname($file), basename($file));
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
chmod($file, 0666 & ~umask());
@chmod($file, 0666 & ~umask());
return;
}

View File

@ -101,7 +101,7 @@ class ConfigCache
$tmpFile = tempnam(dirname($this->file), basename($this->file));
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $this->file)) {
chmod($this->file, 0666 & ~umask());
@chmod($this->file, 0666 & ~umask());
} else {
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $this->file));
}
@ -110,7 +110,7 @@ class ConfigCache
$file = $this->file.'.meta';
$tmpFile = tempnam(dirname($file), basename($file));
if (false !== @file_put_contents($tmpFile, serialize($metadata)) && @rename($tmpFile, $file)) {
chmod($file, 0666 & ~umask());
@chmod($file, 0666 & ~umask());
}
}
}

View File

@ -112,7 +112,7 @@ class Filesystem
public function chmod($files, $mode, $umask = 0000)
{
foreach ($this->toIterator($files) as $file) {
chmod($file, $mode & ~$umask);
@chmod($file, $mode & ~$umask);
}
}

View File

@ -122,7 +122,7 @@ class File extends \SplFileInfo
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message'])));
}
chmod($target, 0666 & ~umask());
@chmod($target, 0666 & ~umask());
return new File($target);
}

View File

@ -84,7 +84,7 @@ class MimeTypeTest extends \PHPUnit_Framework_TestCase
$path = __DIR__.'/../Fixtures/to_delete';
touch($path);
chmod($path, 0333);
@chmod($path, 0333);
if (get_current_user() != 'root' && substr(sprintf('%o', fileperms($path)), -4) == '0333') {
$this->setExpectedException('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException');
@ -98,7 +98,7 @@ class MimeTypeTest extends \PHPUnit_Framework_TestCase
{
$path = __DIR__.'/../Fixtures/to_delete';
if (file_exists($path)) {
chmod($path, 0666);
@chmod($path, 0666);
@unlink($path);
}
}

View File

@ -22,7 +22,7 @@ abstract class CacheWarmer implements CacheWarmerInterface
{
$tmpFile = tempnam(dirname($file), basename($file));
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
chmod($file, 0666 & ~umask());
@chmod($file, 0666 & ~umask());
return;
}

View File

@ -332,7 +332,7 @@ class Store implements StoreInterface
return false;
}
chmod($path, 0666 & ~umask());
@chmod($path, 0666 & ~umask());
}
public function getPath($key)