From 86cf01d433c7f5d99755072dd63139ed8969d3a4 Mon Sep 17 00:00:00 2001 From: Edward Chernenko Date: Mon, 25 Jun 2018 18:40:25 +0300 Subject: [PATCH] LCStoreStaticArray: create cache directory when it doesn't exist Array store (LCStoreStaticArray) should behave as standard LCStoreCDB, creating the target directory when it doesn't exist. This fixes unexpected "No such file or directory" errors when replacing 'files' with 'array' in $wgLocalisationCacheConf['store']. Change-Id: Ie49cf03ca93ac47fc98665de36e6207bef287193 --- includes/cache/localisation/LCStoreStaticArray.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/includes/cache/localisation/LCStoreStaticArray.php b/includes/cache/localisation/LCStoreStaticArray.php index 602c0ac463..38700b85b5 100644 --- a/includes/cache/localisation/LCStoreStaticArray.php +++ b/includes/cache/localisation/LCStoreStaticArray.php @@ -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] = []; -- 2.20.1