Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

twig works without cache folder too now

  • Loading branch information...
commit a7e1289e97d5bd467391698f0efcb5083109eccf 1 parent 164bc03
Armin Ronacher authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 php/Twig/api.php
9 php/Twig/api.php
View
@@ -91,7 +91,14 @@ public function requireTemplate($name)
if (!file_exists($cache_fn) ||
filemtime($cache_fn) < filemtime($fn)) {
twig_load_compiler();
- $fp = fopen($cache_fn, 'wb');
+ $fp = @fopen($cache_fn, 'wb');
+ /* looks like we don't have access to this file.
+ In that case we just load the code from memory */
+ if (!$fp) {
+ $code = $this->compileTemplate($name, NULL, $fn);
+ eval('?>' . $code);
+ return $cls;
+ }
$compiler = new Twig_FileCompiler($fp);
$this->compileTemplate($name, $compiler, $fn);
fclose($fp);
Please sign in to comment.
Something went wrong with that request. Please try again.