Add $context to the ArticleFromTitle hook
authorBrian Wolff <bawolff+wn@gmail.com>
Wed, 11 Dec 2013 21:59:48 +0000 (14:59 -0700)
committerReedy <reedy@wikimedia.org>
Thu, 23 Jan 2014 22:51:11 +0000 (22:51 +0000)
Most of the time people wouldn't need this - this hook is mostly
used to inject a custom Article subclass for a specific
namespace to do fancy things, but lets give users the most
flexibility.

Asked for by leaves on irc.

Change-Id: I3386ff4abe0e5b3eb783604ae222b7703428db44

docs/hooks.txt
includes/Article.php

index 3f1152b..4a43359 100644 (file)
@@ -541,6 +541,7 @@ $wikiPage: WikiPage (object) being modified
 Wiki::articleFromTitle().
 $title: Title (object) used to create the article object
 $article: Article (object) that will be returned
+$context: IContextSource (object)
 
 'ArticleInsertComplete': After a new article is created. DEPRECATED, use
 PageContentInsertComplete.
index 85a34db..e0396a1 100644 (file)
@@ -158,7 +158,7 @@ class Article implements Page {
                }
 
                $page = null;
-               wfRunHooks( 'ArticleFromTitle', array( &$title, &$page ) );
+               wfRunHooks( 'ArticleFromTitle', array( &$title, &$page, $context ) );
                if ( !$page ) {
                        switch ( $title->getNamespace() ) {
                                case NS_FILE: