r109855 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109854‎ | r109855 | r109856 >
Date:21:56, 23 January 2012
Author:hashar
Status:ok
Tags:
Comment:
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
Modified paths:
  • /trunk/phase3/includes/filerepo/backend/FileBackend.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/lockmanager/LockManagerGroup.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/backend/lockmanager/LockManagerGroup.php
@@ -66,14 +66,11 @@
6767 /**
6868 * Get the lock manager object with a given name
6969 *
70 - * @param $name string. Empty value (default) will give a nullLockManager
71 - * @return LockManager (default: nullLockManager)
 70+ * @param $name string
 71+ * @return LockManager
7272 * @throws MWException
7373 */
74 - public function get( $name = null ) {
75 - if( empty( $name ) ) {
76 - $name = 'nullLockManager';
77 - }
 74+ public function get( $name ) {
7875 if ( !isset( $this->managers[$name] ) ) {
7976 throw new MWException( "No lock manager defined with the name `$name`." );
8077 }
Index: trunk/phase3/includes/filerepo/backend/FileBackend.php
@@ -51,13 +51,11 @@
5252 * @param $config Array
5353 */
5454 public function __construct( array $config ) {
55 - $defaultConfig = array(
56 - 'lockManager' => null,
57 - 'wikiId' => wfWikiID(),
58 - );
59 - $config = array_merge( $defaultConfig, $config );
6055 $this->name = $config['name'];
61 - $this->wikiId = $this->resolveWikiId( $config['wikiId'] );
 56+ $this->wikiId = isset( $config['wikiId'] )
 57+ ? $config['wikiId']
 58+ : wfWikiID(); // e.g. "my_wiki-en_"
 59+ $this->wikiId = $this->resolveWikiId( $this->wikiId );
6260 $this->lockManager = LockManagerGroup::singleton()->get( $config['lockManager'] );
6361 $this->readOnly = isset( $config['readOnly'] )
6462 ? (string)$config['readOnly']

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r109814get a null lock manager by defaulthashar10:59, 23 January 2012
r109815cleanly handle wikiId on FileBackendBase construction...hashar11:03, 23 January 2012

Status & tagging log