From d9e92867973eeaa961f5b9a8363668863840d398 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 15 Nov 2011 19:41:32 +0000 Subject: [PATCH] Added Article::newFromWikiPage() function to create an appropriate Article object from a WikiPage and keep the process cache vars of the later --- includes/Article.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/includes/Article.php b/includes/Article.php index 3b22b86b74..fe68ddd41b 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -126,6 +126,19 @@ class Article extends Page { return $page; } + /** + * Create an Article object of the appropriate class for the given page. + * + * @param $page WikiPage + * @param $context IContextSource + * @return Article object + */ + public static function newFromWikiPage( WikiPage $page, IContextSource $context ) { + $article = self::newFromTitle( $page->getTitle(), $context ); + $article->mPage = $page; // override to keep process cached vars + return $article; + } + /** * Tell the page view functions that this view was redirected * from another page on the wiki. -- 2.20.1