From 6f3493994f4cb8d119fbacf6d57ce34df59ea564 Mon Sep 17 00:00:00 2001 From: Jakub Kulhan Date: Mon, 6 Sep 2010 17:41:30 +0200 Subject: [PATCH] FileJournal: creates directory it needs --- Nette/Caching/FileJournal.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Nette/Caching/FileJournal.php b/Nette/Caching/FileJournal.php index 6d7b00b438..9c1df86a7f 100644 --- a/Nette/Caching/FileJournal.php +++ b/Nette/Caching/FileJournal.php @@ -101,7 +101,15 @@ class FileJournal extends Nette\Object implements ICacheJournal */ public function __construct($dir) { + if (!is_dir($dir)) { + umask(0000); + if (!@mkdir($dir, 0777, TRUE)) { // intentionally @ + throw new \InvalidStateException('Cannot create directory ' . $dir . '.'); + } + } + $this->file = $dir . '/' . self::FILE; + $this->open(); }