reverts r109814 r109815
authorAntoine Musso <hashar@users.mediawiki.org>
Mon, 23 Jan 2012 21:56:00 +0000 (21:56 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Mon, 23 Jan 2012 21:56:00 +0000 (21:56 +0000)
* Ternary operator avoided a call to wfWikiID()
* We really want to explicitly choose the manager
  use LockManagerGroup->get( 'nullLockManager' )
* defaultConfig no more needed if it handles just one parameter that
  we want to set explicitly

includes/filerepo/backend/FileBackend.php
includes/filerepo/backend/lockmanager/LockManagerGroup.php

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