r108800 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108799‎ | r108800 | r108801 >
Date:09:14, 13 January 2012
Author:aaron
Status:ok (Comments)
Tags:
Comment:
r88633: lazy-load 'customFilters' field in SpecialRecentChanges. Almost every function is public here so there no control of the order stuff happens.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialRecentchanges.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialRecentchanges.php
@@ -73,9 +73,7 @@
7474 public function setup( $parameters ) {
7575 $opts = $this->getDefaultOptions();
7676
77 - $this->customFilters = array();
78 - wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters ) );
79 - foreach( $this->customFilters as $key => $params ) {
 77+ foreach( $this->getCustomFilters() as $key => $params ) {
8078 $opts->add( $key, $params['default'] );
8179 }
8280
@@ -91,6 +89,19 @@
9290 }
9391
9492 /**
 93+ * Get custom show/hide filters
 94+ *
 95+ * @return Array Map of filter URL param names to properties (msg/default)
 96+ */
 97+ protected function getCustomFilters() {
 98+ if ( $this->customFilters === null ) {
 99+ $this->customFilters = array();
 100+ wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters ) );
 101+ }
 102+ return $this->customFilters;
 103+ }
 104+
 105+ /**
95106 * Create a FormOptions object specific for feed requests and return it
96107 *
97108 * @return FormOptions
@@ -806,14 +817,14 @@
807818 // show/hide links
808819 $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ) );
809820 $filters = array(
810 - 'hideminor' => 'rcshowhideminor',
811 - 'hidebots' => 'rcshowhidebots',
812 - 'hideanons' => 'rcshowhideanons',
813 - 'hideliu' => 'rcshowhideliu',
 821+ 'hideminor' => 'rcshowhideminor',
 822+ 'hidebots' => 'rcshowhidebots',
 823+ 'hideanons' => 'rcshowhideanons',
 824+ 'hideliu' => 'rcshowhideliu',
814825 'hidepatrolled' => 'rcshowhidepatr',
815 - 'hidemyself' => 'rcshowhidemine'
 826+ 'hidemyself' => 'rcshowhidemine'
816827 );
817 - foreach ( $this->customFilters as $key => $params ) {
 828+ foreach ( $this->getCustomFilters() as $key => $params ) {
818829 $filters[$key] = $params['msg'];
819830 }
820831 // Disable some if needed

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88633* In core:...aaron04:28, 23 May 2011

Comments

#Comment by Nikerabbit (talk | contribs)   10:30, 13 January 2012

Confirmed fixed.

Status & tagging log