From 164ca2e5b6046d8cd8375d391ac61e316e8c7dd0 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 13 Jan 2012 09:14:56 +0000 Subject: [PATCH] r88633: lazy-load 'customFilters' field in SpecialRecentChanges. Almost every function is public here so there no control of the order stuff happens. --- includes/specials/SpecialRecentchanges.php | 29 +++++++++++++++------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 51baef9347..067a95644f 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -73,9 +73,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { public function setup( $parameters ) { $opts = $this->getDefaultOptions(); - $this->customFilters = array(); - wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters ) ); - foreach( $this->customFilters as $key => $params ) { + foreach( $this->getCustomFilters() as $key => $params ) { $opts->add( $key, $params['default'] ); } @@ -90,6 +88,19 @@ class SpecialRecentChanges extends IncludableSpecialPage { return $opts; } + /** + * Get custom show/hide filters + * + * @return Array Map of filter URL param names to properties (msg/default) + */ + protected function getCustomFilters() { + if ( $this->customFilters === null ) { + $this->customFilters = array(); + wfRunHooks( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters ) ); + } + return $this->customFilters; + } + /** * Create a FormOptions object specific for feed requests and return it * @@ -806,14 +817,14 @@ class SpecialRecentChanges extends IncludableSpecialPage { // show/hide links $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ) ); $filters = array( - 'hideminor' => 'rcshowhideminor', - 'hidebots' => 'rcshowhidebots', - 'hideanons' => 'rcshowhideanons', - 'hideliu' => 'rcshowhideliu', + 'hideminor' => 'rcshowhideminor', + 'hidebots' => 'rcshowhidebots', + 'hideanons' => 'rcshowhideanons', + 'hideliu' => 'rcshowhideliu', 'hidepatrolled' => 'rcshowhidepatr', - 'hidemyself' => 'rcshowhidemine' + 'hidemyself' => 'rcshowhidemine' ); - foreach ( $this->customFilters as $key => $params ) { + foreach ( $this->getCustomFilters() as $key => $params ) { $filters[$key] = $params['msg']; } // Disable some if needed -- 2.20.1