Revert r106545 and pass a null variable by ref (also updated the documentation) so...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 18 Dec 2011 14:48:23 +0000 (14:48 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 18 Dec 2011 14:48:23 +0000 (14:48 +0000)
This is *exactly* the same behaviour as before r88898 since $article was an out parameter to fill $wgArticle correctly.

docs/hooks.txt
includes/Wiki.php

index 2e9e4a7..2d63e8b 100644 (file)
@@ -587,9 +587,9 @@ $name: Image name being checked
 Change $bad and return false to override. If an image is "bad", it is not
 rendered inline in wiki pages or galleries in category pages.
 
-'BeforeInitialize': before anything is initialized in performRequestForTitle()
+'BeforeInitialize': before anything is initialized in MediaWiki::performRequest()
 &$title: Title being used for request
-&$article: The associated Article object
+$unused: null
 &$output: OutputPage object
 &$user: User
 $request: WebRequest object
index 8b62139..2a3444e 100644 (file)
@@ -146,6 +146,9 @@ class MediaWiki {
                        $output->setPrintable();
                }
 
+               $unused = null; // To pass it by reference
+               wfRunHooks( 'BeforeInitialize', array( &$title, &$unused, &$output, &$user, $request, $this ) );
+
                // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
                if ( is_null( $title ) || ( $title->getDBkey() == '' && $title->getInterwiki() == '' ) ||
                        $title->isSpecial( 'Badtitle' ) )
@@ -267,8 +270,6 @@ class MediaWiki {
                                wfProfileOut( __METHOD__ );
                                throw new MWException( "Shouldn't happen: MediaWiki::initializeArticle() returned neither an object nor a URL" );
                        }
-                       wfRunHooks( 'BeforeInitialize',
-                               array( &$title, &$article, &$output, &$user, $request, $this ) );
                }
 
                if ( $pageView ) {