r103215 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103214‎ | r103215 | r103216 >
Date:19:46, 15 November 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
FU r93061, r102565:
* Added more bits to 1.18 release-notes
* Backported r103214 to help with creating Article objects efficiently
Modified paths:
  • /branches/REL1_18/phase3/RELEASE-NOTES-1.18 (modified) (history)
  • /branches/REL1_18/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/RELEASE-NOTES-1.18
@@ -101,7 +101,10 @@
102102 * BREAKING CHANGE: Article class heirarchy split into WikiPage (backend)
103103 and Article (frontend) hierarchies. Several hooks now pass a WikiPage object instead
104104 of an Article object. These hooks all use an $article paramater as documented in hooks.txt.
105 - Extensions should be updated to account for this, though most won't require any changes.
 105+ Extensions must be updated to account for this, though most won't require any changes.
 106+ Callers using $article->fetchContent() or $article->getContent(), that only want the
 107+ current version article text, should use $article->getText() instead. If the Article class
 108+ functions are required, an article object can be created using Article::newFromWikiPage().
106109 * (bug 27860) Minor edit after clicking 'new section' tab
107110 Now the "This is a minor edit" checkbox is not available when you
108111 create a page or new section.
Index: branches/REL1_18/phase3/includes/Article.php
@@ -117,6 +117,19 @@
118118 }
119119
120120 /**
 121+ * Create an Article object of the appropriate class for the given page.
 122+ *
 123+ * @param $page WikiPage
 124+ * @param $context IContextSource
 125+ * @return Article object
 126+ */
 127+ public static function newFromWikiPage( WikiPage $page, IContextSource $context ) {
 128+ $article = self::newFromTitle( $page->getTitle(), $context );
 129+ $article->mPage = $page; // override to keep process cached vars
 130+ return $article;
 131+ }
 132+
 133+ /**
121134 * Tell the page view functions that this view was redirected
122135 * from another page on the wiki.
123136 * @param $from Title object.

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93061Updated hooks docs per r91123. The UI methods are not part of the object anym...aaron16:44, 25 July 2011
r102565Release notes for r93061aaron20:26, 9 November 2011
r103214Added Article::newFromWikiPage() function to create an appropriate Article ob...aaron19:41, 15 November 2011

Comments

#Comment by Nikerabbit (talk | contribs)   07:25, 16 November 2011

@since?

Status & tagging log