r97079 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97078‎ | r97079 | r97080 >
Date:17:51, 14 September 2011
Author:aaron
Status:ok
Tags:
Comment:
Fixed WikiPage::newFromId to use the factory() function
Modified paths:
  • /trunk/phase3/includes/WikiCategoryPage.php (modified) (history)
  • /trunk/phase3/includes/WikiFilePage.php (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WikiFilePage.php
@@ -10,7 +10,7 @@
1111 protected $mFileLoaded = false; // !<
1212 protected $mDupes = null; // !<
1313
14 - function __construct( $title ) {
 14+ public function __construct( $title ) {
1515 parent::__construct( $title );
1616 $this->mDupes = null;
1717 $this->mRepo = null;
Index: trunk/phase3/includes/WikiPage.php
@@ -79,17 +79,16 @@
8080 /**
8181 * Constructor from a page id
8282 *
83 - * Always override this for all subclasses (until we use PHP with LSB)
84 - *
8583 * @param $id Int article ID to load
8684 *
8785 * @return WikiPage
8886 */
8987 public static function newFromID( $id ) {
9088 $t = Title::newFromID( $id );
91 - # @todo FIXME: Doesn't inherit right
92 - return $t == null ? null : new self( $t );
93 - # return $t == null ? null : new static( $t ); // PHP 5.3
 89+ if ( $t ) {
 90+ return self::factory( $t );
 91+ }
 92+ return null;
9493 }
9594
9695 /**
Index: trunk/phase3/includes/WikiCategoryPage.php
@@ -4,19 +4,6 @@
55 */
66 class WikiCategoryPage extends WikiPage {
77 /**
8 - * Constructor from a page id
9 - * @param $id Int article ID to load
10 - *
11 - * @return WikiCategoryPage
12 - */
13 - public static function newFromID( $id ) {
14 - $t = Title::newFromID( $id );
15 - # @todo FIXME: Doesn't inherit right
16 - return $t == null ? null : new self( $t );
17 - # return $t == null ? null : new static( $t ); // PHP 5.3
18 - }
19 -
20 - /**
218 * Don't return a 404 for categories in use.
229 * In use defined as: either the actual page exists
2310 * or the category currently has members.

Follow-up revisions

RevisionCommit summaryAuthorDate
r97082Merged revisions 97057,97060,97071,97073-97074,97077-97080 via svnmerge from...dantman18:11, 14 September 2011

Status & tagging log