From: Aaron Schulz Date: Fri, 13 Jan 2012 09:14:56 +0000 (+0000) Subject: r88633: lazy-load 'customFilters' field in SpecialRecentChanges. Almost every functio... X-Git-Tag: 1.31.0-rc.0~25307 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/categories/modifier.php?a=commitdiff_plain;h=164ca2e5b6046d8cd8375d391ac61e316e8c7dd0;p=lhc%2Fweb%2Fwiklou.git r88633: lazy-load 'customFilters' field in SpecialRecentChanges. Almost every function is public here so there no control of the order stuff happens. --- 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