localisation: Inject 'directory' option to LCStore classes
[lhc/web/wiklou.git] / includes / cache / localisation / LCStoreStaticArray.php
index 75c8465..5911656 100644 (file)
@@ -39,17 +39,13 @@ class LCStoreStaticArray implements LCStore {
        private $directory;
 
        public function __construct( $conf = [] ) {
-               global $wgCacheDirectory;
-
-               $this->directory = $conf['directory'] ?? $wgCacheDirectory;
+               $this->directory = $conf['directory'];
        }
 
        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}\"" );
-                       }
+               if ( !file_exists( $this->directory ) && !wfMkdirParents( $this->directory, null, __METHOD__ ) ) {
+                       throw new MWException( "Unable to create the localisation store " .
+                               "directory \"{$this->directory}\"" );
                }
 
                $this->currentLang = $code;
@@ -101,8 +97,7 @@ class LCStoreStaticArray implements LCStore {
                        return $encoded;
                }
 
-               $type = $encoded[0];
-               $data = $encoded[1];
+               list( $type, $data ) = $encoded;
 
                switch ( $type ) {
                        case 'a':