Fix chmod() calls to apply umask

This commit is contained in:
Jordi Boggiano 2012-04-19 13:35:17 +02:00
parent 13c07d1469
commit 5c059aa121
5 changed files with 6 additions and 6 deletions

View File

@ -181,7 +181,7 @@ class ClassCollectionLoader
{
$tmpFile = tempnam(dirname($file), basename($file));
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
chmod($file, 0777);
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);
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);
chmod($file, 0666 ^ 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);
chmod($target, 0666 ^ umask());
return new File($target);
}

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, 0644);
chmod($file, 0666 ^ umask());
return;
}

View File

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