X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcache%2Flocalisation%2FLCStoreStaticArray.php;h=53893bdbe43139961a76119ac08b155c95b6c287;hb=54c93f1d384cd5accd2db2ebbb911e4d627c2980;hp=f8601468045be93aa999856dba207a34cef0eba6;hpb=9fc202b69496353a1142a692be5aaf158e9ea30c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/localisation/LCStoreStaticArray.php b/includes/cache/localisation/LCStoreStaticArray.php index f860146804..53893bdbe4 100644 --- a/includes/cache/localisation/LCStoreStaticArray.php +++ b/includes/cache/localisation/LCStoreStaticArray.php @@ -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; @@ -125,6 +121,8 @@ class LCStoreStaticArray implements LCStore { 'Generated by LCStoreStaticArray.php -- do not edit!' ); file_put_contents( $this->fname, $out ); + // Release the data to manage the memory in rebuildLocalisationCache + unset( $this->data[$this->currentLang] ); $this->currentLang = null; $this->fname = null; }