Skip to content

Commit

Permalink
Reduce the name of the cache directories to 1 character
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan Darricau committed Apr 28, 2015
1 parent 7d5fe0f commit 2972309
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Twig/Environment.php
Expand Up @@ -250,7 +250,7 @@ public function getCacheFilename($name)

$class = substr($this->getTemplateClass($name), strlen($this->templateClassPrefix));

return $this->getCache().'/'.substr($class, 0, 2).'/'.substr($class, 2, 2).'/'.substr($class, 4).'.php';
return $this->getCache().'/'.$class[0].'/'.$class[1].'/'.$class.'.php';
}

/**
Expand Down Expand Up @@ -1271,11 +1271,11 @@ protected function writeCacheFile($file, $content)
if (false === @mkdir($dir, 0777, true)) {
clearstatcache(false, $dir);
if (!is_dir($dir)) {
throw new RuntimeException(sprintf("Unable to create the cache directory (%s).", $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));
throw new RuntimeException(sprintf('Unable to write in the cache directory (%s).', $dir));
}

$tmpFile = tempnam($dir, basename($file));
Expand Down

0 comments on commit 2972309

Please sign in to comment.