SpecialPage: Remove wfSpecial* call syntax
authorChad Horohoe <chadh@wikimedia.org>
Mon, 5 May 2014 18:54:02 +0000 (11:54 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Wed, 4 Jun 2014 20:43:02 +0000 (22:43 +0200)
Should've done this years ago. Anything still using this syntax is long
since broken in half a dozen other ways anyway.

Change-Id: I0e78453544abb5de7935b046c838ae5b3c4da802

RELEASE-NOTES-1.24
includes/specialpage/SpecialPage.php

index 47fc80f..9cd0c11 100644 (file)
@@ -128,6 +128,8 @@ changes to languages because of Bugzilla reports.
   like "headlinks", "skinnameclass", etc. to be defined.
 * The deprecated 'SpecialVersionExtensionTypes' hook was removed.
 * (bug 63891) Add 'X-Robots-Tag: noindex' header in action=render pages.
+* SpecialPage no longer supports the syntax for invoking wfSpecial*() functions.
+  All special pages should subclass SpecialPage and implement the execute() method.
 
 ==== Renamed classes ====
 * CLDRPluralRuleConverter_Expression to CLDRPluralRuleConverterExpression
index 7ec9f4a..3968187 100644 (file)
@@ -45,12 +45,6 @@ class SpecialPage {
        // Listed in Special:Specialpages?
        private $mListed;
 
-       // Function name called by the default execute()
-       private $mFunction;
-
-       // File which needs to be included before the function above can be called
-       private $mFile;
-
        // Whether or not this special page is being included from an article
        protected $mIncluding;
 
@@ -107,30 +101,18 @@ class SpecialPage {
         * @param string $name Name of the special page, as seen in links and URLs
         * @param string $restriction User right required, e.g. "block" or "delete"
         * @param bool $listed Whether the page is listed in Special:Specialpages
-        * @param callable|bool $function Function called by execute(). By default
-        *   it is constructed from $name
-        * @param string $file File which is included by execute(). It is also
-        *   constructed from $name by default
+        * @param callable|bool $function unused
+        * @param string $file unused
         * @param bool $includable Whether the page can be included in normal pages
         */
        public function __construct(
                $name = '', $restriction = '', $listed = true,
-               $function = false, $file = 'default', $includable = false
+               $function = false, $file = '', $includable = false
        ) {
                $this->mName = $name;
                $this->mRestriction = $restriction;
                $this->mListed = $listed;
                $this->mIncludable = $includable;
-               if ( !$function ) {
-                       $this->mFunction = 'wfSpecial' . $name;
-               } else {
-                       $this->mFunction = $function;
-               }
-               if ( $file === 'default' ) {
-                       $this->mFile = __DIR__ . "/specials/Special$name.php";
-               } else {
-                       $this->mFile = $file;
-               }
        }
 
        /**
@@ -414,7 +396,7 @@ class SpecialPage {
 
        /**
         * Default execute method
-        * Checks user permissions, calls the function given in mFunction
+        * Checks user permissions
         *
         * This must be overridden by subclasses; it will be made abstract in a future version
         *
@@ -423,14 +405,7 @@ class SpecialPage {
        public function execute( $subPage ) {
                $this->setHeaders();
                $this->checkPermissions();
-
-               $func = $this->mFunction;
-               // only load file if the function does not exist
-               if ( !is_callable( $func ) && $this->mFile ) {
-                       require_once $this->mFile;
-               }
                $this->outputHeader();
-               call_user_func( $func, $subPage, $this );
        }
 
        /**