From: Antoine Musso Date: Mon, 23 Jan 2012 21:56:00 +0000 (+0000) Subject: reverts r109814 r109815 X-Git-Tag: 1.31.0-rc.0~25111 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=3f32bbb5517fa2cc1c873640f6239d9c693b9b11;p=lhc%2Fweb%2Fwiklou.git reverts r109814 r109815 * 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 --- diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index 98e1187bab..ee0d31210c 100644 --- a/includes/filerepo/backend/FileBackend.php +++ b/includes/filerepo/backend/FileBackend.php @@ -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'] diff --git a/includes/filerepo/backend/lockmanager/LockManagerGroup.php b/includes/filerepo/backend/lockmanager/LockManagerGroup.php index a3705ada6c..3fa91d581d 100644 --- a/includes/filerepo/backend/lockmanager/LockManagerGroup.php +++ b/includes/filerepo/backend/lockmanager/LockManagerGroup.php @@ -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`." ); }