protected function writeCacheFile($file, $content)
{
- if (!is_dir(dirname($file))) {
- mkdir(dirname($file), 0777, true);
+ $dir = dirname($file);
+ if (!is_dir($dir)) {
+ if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
+ throw new RuntimeException(sprintf("Unable to create the cache directory (%s).", $dir));
+ }
+ } elseif (!is_writable($dir)) {
+ throw new RuntimeException(sprintf("Unable to write in the cache directory (%s).", $dir));
}
$tmpFile = tempnam(dirname($file), basename($file));