From: Aaron Schulz Date: Wed, 14 Sep 2011 17:51:37 +0000 (+0000) Subject: Fixed WikiPage::newFromId to use the factory() function X-Git-Tag: 1.31.0-rc.0~27665 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=567a49991a9de26249dcdc33d27c82c147267942;p=lhc%2Fweb%2Fwiklou.git Fixed WikiPage::newFromId to use the factory() function --- diff --git a/includes/WikiCategoryPage.php b/includes/WikiCategoryPage.php index 1bbc691d6a..b8cc268582 100644 --- a/includes/WikiCategoryPage.php +++ b/includes/WikiCategoryPage.php @@ -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 diff --git a/includes/WikiFilePage.php b/includes/WikiFilePage.php index 6727a8cd8f..2d8108fb0d 100644 --- a/includes/WikiFilePage.php +++ b/includes/WikiFilePage.php @@ -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; diff --git a/includes/WikiPage.php b/includes/WikiPage.php index ffdf8f75cd..817a1d274b 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -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; } /**