Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -740,8 +740,13 @@ |
741 | 741 | if ( $this->userCanExecute( $wgUser ) ) { |
742 | 742 | $func = $this->mFunction; |
743 | 743 | // only load file if the function does not exist |
744 | | - if(!is_callable($func) and $this->mFile) { |
745 | | - require_once( $this->mFile ); |
| 744 | + if ( !is_callable( $func ) ) { |
| 745 | + // Check whether a run method has been defined |
| 746 | + if ( is_callable( array( $this, 'run' ) ) ) |
| 747 | + $func = array( $this, 'run' ); |
| 748 | + // Else load from file if it has been specified |
| 749 | + elseif ( $this->mFile ) |
| 750 | + require_once( $this->mFile ); |
746 | 751 | } |
747 | 752 | # FIXME: these hooks are broken for extensions and anything else that subclasses SpecialPage. |
748 | 753 | if ( wfRunHooks( 'SpecialPageExecuteBeforeHeader', array( &$this, &$par, &$func ) ) ) |
— | — | @@ -756,6 +761,7 @@ |
757 | 762 | } |
758 | 763 | } |
759 | 764 | |
| 765 | + |
760 | 766 | function outputHeader() { |
761 | 767 | global $wgOut, $wgContLang; |
762 | 768 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -145,6 +145,8 @@ |
146 | 146 | $wgExternalLinkTarget |
147 | 147 | * api.php now sends "Retry-After" and "X-Database-Lag" HTTP headers if the maxlag |
148 | 148 | check fails, just like index.php does |
| 149 | +* Classes derived from SpecialPage can now specify a run() method, which will |
| 150 | + be executed after all magic performed by SpecialPage::execute() |
149 | 151 | |
150 | 152 | |
151 | 153 | === Bug fixes in 1.14 === |