r27418 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r27417‎ | r27418 | r27419 >
Date:07:32, 12 November 2007
Author:tstarling
Status:old
Tags:
Comment:
Allow the special page function to be a callback, not just a function name.
Modified paths:
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialPage.php
@@ -643,7 +643,7 @@
644644 if ( $this->userCanExecute( $wgUser ) ) {
645645 $func = $this->mFunction;
646646 // only load file if the function does not exist
647 - if(!function_exists($func) and $this->mFile) {
 647+ if(!is_callable($func) and $this->mFile) {
648648 require_once( $this->mFile );
649649 }
650650 # FIXME: these hooks are broken for extensions and anything else that subclasses SpecialPage.
@@ -651,7 +651,7 @@
652652 $this->outputHeader();
653653 if ( ! wfRunHooks( 'SpecialPageExecuteBeforePage', array( &$this, &$par, &$func ) ) )
654654 return;
655 - $func( $par, $this );
 655+ call_user_func( $func, $par, $this );
656656 if ( ! wfRunHooks( 'SpecialPageExecuteAfterPage', array( &$this, &$par, &$func ) ) )
657657 return;
658658 } else {

Status & tagging log