diff options
author | Aaron Schulz <aaron@users.mediawiki.org> | 2012-01-13 09:14:56 +0000 |
---|---|---|
committer | Aaron Schulz <aaron@users.mediawiki.org> | 2012-01-13 09:14:56 +0000 |
commit | 164ca2e5b6046d8cd8375d391ac61e316e8c7dd0 (patch) | |
tree | b8f93b5cb6fbb9bcb4f4bb6252525ce3a7d85280 /includes/specials | |
parent | 0455e574cbbcd09ce845e9a4e8e8fb810ae06023 (diff) | |
download | mediawikicore-164ca2e5b6046d8cd8375d391ac61e316e8c7dd0.tar.gz mediawikicore-164ca2e5b6046d8cd8375d391ac61e316e8c7dd0.zip |
r88633: lazy-load 'customFilters' field in SpecialRecentChanges. Almost every function is public here so there no control of the order stuff happens.
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/108800
Diffstat (limited to 'includes/specials')
-rw-r--r-- | includes/specials/SpecialRecentchanges.php | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 51baef934754..067a95644f25 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'] ); } @@ -91,6 +89,19 @@ class SpecialRecentChanges extends IncludableSpecialPage { } /** + * 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 * * @return FormOptions @@ -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 |