Fixed WikiPage::newFromId to use the factory() function
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 14 Sep 2011 17:51:37 +0000 (17:51 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 14 Sep 2011 17:51:37 +0000 (17:51 +0000)
includes/WikiCategoryPage.php
includes/WikiFilePage.php
includes/WikiPage.php

index 1bbc691..b8cc268 100644 (file)
@@ -3,19 +3,6 @@
  * Special handling for category pages
  */
 class WikiCategoryPage extends WikiPage {
-       /**
-        * Constructor from a page id
-        * @param $id Int article ID to load
-        *
-        * @return WikiCategoryPage
-        */
-       public static function newFromID( $id ) {
-               $t = Title::newFromID( $id );
-               # @todo FIXME: Doesn't inherit right
-               return $t == null ? null : new self( $t );
-               # return $t == null ? null : new static( $t ); // PHP 5.3
-       }
-
        /**
         * Don't return a 404 for categories in use.
         * In use defined as: either the actual page exists
index 6727a8c..2d8108f 100644 (file)
@@ -10,7 +10,7 @@ class WikiFilePage extends WikiPage {
        protected $mFileLoaded = false;             // !<
        protected $mDupes = null;                               // !<
 
-       function __construct( $title ) {
+       public function __construct( $title ) {
                parent::__construct( $title );
                $this->mDupes = null;
                $this->mRepo = null;
index ffdf8f7..817a1d2 100644 (file)
@@ -79,17 +79,16 @@ class WikiPage extends Page {
        /**
         * Constructor from a page id
         *
-        * Always override this for all subclasses (until we use PHP with LSB)
-        *
         * @param $id Int article ID to load
         *
         * @return WikiPage
         */
        public static function newFromID( $id ) {
                $t = Title::newFromID( $id );
-               # @todo FIXME: Doesn't inherit right
-               return $t == null ? null : new self( $t );
-               # return $t == null ? null : new static( $t ); // PHP 5.3
+               if ( $t ) {
+                       return self::factory( $t );
+               }
+               return null;
        }
 
        /**