Index: branches/REL1_18/phase3/RELEASE-NOTES-1.18 |
— | — | @@ -101,7 +101,10 @@ |
102 | 102 | * BREAKING CHANGE: Article class heirarchy split into WikiPage (backend) |
103 | 103 | and Article (frontend) hierarchies. Several hooks now pass a WikiPage object instead |
104 | 104 | 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(). |
106 | 109 | * (bug 27860) Minor edit after clicking 'new section' tab |
107 | 110 | Now the "This is a minor edit" checkbox is not available when you |
108 | 111 | create a page or new section. |
Index: branches/REL1_18/phase3/includes/Article.php |
— | — | @@ -117,6 +117,19 @@ |
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
| 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 | + /** |
121 | 134 | * Tell the page view functions that this view was redirected |
122 | 135 | * from another page on the wiki. |
123 | 136 | * @param $from Title object. |