Merge "LCStoreStaticArray: create cache directory when it doesn't exist"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 25 Jun 2018 18:30:17 +0000 (18:30 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 25 Jun 2018 18:30:17 +0000 (18:30 +0000)
includes/cache/localisation/LCStoreStaticArray.php

index 602c0ac..38700b8 100644 (file)
@@ -47,6 +47,13 @@ class LCStoreStaticArray implements LCStore {
        }
 
        public function startWrite( $code ) {
+               if ( !file_exists( $this->directory ) ) {
+                       if ( !wfMkdirParents( $this->directory, null, __METHOD__ ) ) {
+                               throw new MWException( "Unable to create the localisation store " .
+                                       "directory \"{$this->directory}\"" );
+                       }
+               }
+
                $this->currentLang = $code;
                $this->fname = $this->directory . '/' . $code . '.l10n.php';
                $this->data[$code] = [];