From: Aaron Schulz Date: Tue, 15 Nov 2011 19:41:32 +0000 (+0000) Subject: Added Article::newFromWikiPage() function to create an appropriate Article object... X-Git-Tag: 1.31.0-rc.0~26483 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=d9e92867973eeaa961f5b9a8363668863840d398;p=lhc%2Fweb%2Fwiklou.git Added Article::newFromWikiPage() function to create an appropriate Article object from a WikiPage and keep the process cache vars of the later --- 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.