add possibility to close a LCStore_CDB
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 19 Nov 2011 16:23:52 +0000 (16:23 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 19 Nov 2011 16:23:52 +0000 (16:23 +0000)
also close an LCStore_CDB after checking for expiry

includes/LocalisationCache.php

index ad707dc..828ed1c 100644 (file)
@@ -358,6 +358,7 @@ class LocalisationCache {
                $deps = $this->store->get( $code, 'deps' );
                $keys = $this->store->get( $code, 'list', 'messages' );
                $preload = $this->store->get( $code, 'preload' );
+               $this->store->close( $code );
                // Different keys may expire separately, at least in LCStore_Accel
                if ( $deps === null || $keys === null || $preload === null ) {
                        wfDebug( __METHOD__."($code): cache missing, need to make one\n" );
@@ -1032,6 +1033,13 @@ class LCStore_CDB implements LCStore {
                }
        }
 
+       public function close( $code ) {
+               if ( !isset( $this->readers[$code] ) ) {
+                       return;
+               }
+               $this->readers[$code]->close();
+       }
+
        public function startWrite( $code ) {
                if ( !file_exists( $this->directory ) ) {
                        if ( !wfMkdirParents( $this->directory, null, __METHOD__ ) ) {
@@ -1186,4 +1194,4 @@ class LocalisationCache_BulkLoad extends LocalisationCache {
                        $this->unload( $code );
                }
        }
-}
\ No newline at end of file
+}