From f5554d3ad7b3a9e42f4b915d654e70d249e562a3 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Thu, 2 Oct 2008 17:30:04 +0000 Subject: [PATCH] Classes derived from SpecialPage can now specify a run() method, which will be executed after all magic performed by SpecialPage::execute(). Just because copying code to subclasses is annoying. --- RELEASE-NOTES | 2 ++ includes/SpecialPage.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d78a19299b..59d6345c00 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -145,6 +145,8 @@ The following extensions are migrated into MediaWiki 1.14: $wgExternalLinkTarget * api.php now sends "Retry-After" and "X-Database-Lag" HTTP headers if the maxlag check fails, just like index.php does +* Classes derived from SpecialPage can now specify a run() method, which will + be executed after all magic performed by SpecialPage::execute() === Bug fixes in 1.14 === diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index fec6c0a88a..b96ab67402 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -740,8 +740,13 @@ class SpecialPage if ( $this->userCanExecute( $wgUser ) ) { $func = $this->mFunction; // only load file if the function does not exist - if(!is_callable($func) and $this->mFile) { - require_once( $this->mFile ); + if ( !is_callable( $func ) ) { + // Check whether a run method has been defined + if ( is_callable( array( $this, 'run' ) ) ) + $func = array( $this, 'run' ); + // Else load from file if it has been specified + elseif ( $this->mFile ) + require_once( $this->mFile ); } # FIXME: these hooks are broken for extensions and anything else that subclasses SpecialPage. if ( wfRunHooks( 'SpecialPageExecuteBeforeHeader', array( &$this, &$par, &$func ) ) ) @@ -756,6 +761,7 @@ class SpecialPage } } + function outputHeader() { global $wgOut, $wgContLang; -- 2.20.1