diff --git a/module/VuFind/src/VuFind/Config/Writer.php b/module/VuFind/src/VuFind/Config/Writer.php index 365ad328c220a64b1f241e946ace4c70d22a8ba0..bb5da67b58f932d9ba263ef34fc6ffe1fc624fee 100644 --- a/module/VuFind/src/VuFind/Config/Writer.php +++ b/module/VuFind/src/VuFind/Config/Writer.php @@ -146,6 +146,20 @@ class Writer */ public function save() { + // Create parent directory structure if necessary: + $stack = array(); + $dirname = dirname($this->filename); + while (!empty($dirname) && !is_dir($dirname)) { + $stack[] = $dirname; + $dirname = dirname($dirname); + } + foreach (array_reverse($stack) as $dir) { + if (!mkdir($dir)) { + return false; + } + } + + // Write the file: return file_put_contents($this->filename, $this->getContent()); }