r109814 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109813‎ | r109814 | r109815 >
Date:10:59, 23 January 2012
Author:hashar
Status:reverted (Comments)
Tags:
Comment:
get a null lock manager by default
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,11 +66,14 @@
6767 /**
6868 * Get the lock manager object with a given name
6969 *
70 - * @param $name string
71 - * @return LockManager
 70+ * @param $name string. Empty value (default) will give a nullLockManager
 71+ * @return LockManager (default: nullLockManager)
7272 * @throws MWException
7373 */
74 - public function get( $name ) {
 74+ public function get( $name = null ) {
 75+ if( empty( $name ) ) {
 76+ $name = 'nullLockManager';
 77+ }
7578 if ( !isset( $this->managers[$name] ) ) {
7679 throw new MWException( "No lock manager defined with the name `$name`." );
7780 }
Index: trunk/phase3/includes/filerepo/backend/FileBackend.php
@@ -51,6 +51,10 @@
5252 * @param $config Array
5353 */
5454 public function __construct( array $config ) {
 55+ $defaultConfig = array(
 56+ 'lockManager' => null,
 57+ );
 58+ $config = array_merge( $defaultConfig, $config );
5559 $this->name = $config['name'];
5660 $this->wikiId = isset( $config['wikiId'] )
5761 ? $config['wikiId']

Follow-up revisions

RevisionCommit summaryAuthorDate
r109815cleanly handle wikiId on FileBackendBase construction...hashar11:03, 23 January 2012
r109855reverts r109814 r109815...hashar21:56, 23 January 2012

Comments

#Comment by 😂 (talk | contribs)   20:35, 23 January 2012

No need for the empty() in LockManagerGroup.

#Comment by Aaron Schulz (talk | contribs)   20:39, 23 January 2012

Also please remove the cruft in get(). Just call get with 'nullLockManager' to begin with rather than the ugly default stuff.

Status & tagging log