get a null lock manager by default
authorAntoine Musso <hashar@users.mediawiki.org>
Mon, 23 Jan 2012 10:59:02 +0000 (10:59 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Mon, 23 Jan 2012 10:59:02 +0000 (10:59 +0000)
includes/filerepo/backend/FileBackend.php
includes/filerepo/backend/lockmanager/LockManagerGroup.php

index ee0d312..dcd0317 100644 (file)
@@ -51,6 +51,10 @@ abstract class FileBackendBase {
         * @param $config Array
         */
        public function __construct( array $config ) {
+               $defaultConfig = array(
+                       'lockManager' => null,
+               );
+               $config = array_merge(  $defaultConfig, $config );
                $this->name = $config['name'];
                $this->wikiId = isset( $config['wikiId'] )
                        ? $config['wikiId']
index 3fa91d5..a3705ad 100644 (file)
@@ -66,11 +66,14 @@ class LockManagerGroup {
        /**
         * Get the lock manager object with a given name
         *
-        * @param $name string
-        * @return LockManager
+        * @param $name string. Empty value (default) will give a nullLockManager
+        * @return LockManager (default: nullLockManager)
         * @throws MWException
         */
-       public function get( $name ) {
+       public function get( $name = null ) {
+               if( empty( $name ) ) {
+                       $name = 'nullLockManager';
+               }
                if ( !isset( $this->managers[$name] ) ) {
                        throw new MWException( "No lock manager defined with the name `$name`." );
                }