From: Edward Chernenko Date: Mon, 25 Jun 2018 15:40:25 +0000 (+0300) Subject: LCStoreStaticArray: create cache directory when it doesn't exist X-Git-Tag: 1.34.0-rc.0~4971^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=86cf01d433c7f5d99755072dd63139ed8969d3a4;p=lhc%2Fweb%2Fwiklou.git 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 --- 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] = [];