From 921bced830bf57dc69fa867a6c92894c54d1b365 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 18 Dec 2011 14:48:23 +0000 Subject: [PATCH] Revert r106545 and pass a null variable by ref (also updated the documentation) so that the hook is called at the correct moment and after everything is executed. This is *exactly* the same behaviour as before r88898 since $article was an out parameter to fill $wgArticle correctly. --- docs/hooks.txt | 4 ++-- includes/Wiki.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 2e9e4a7022..2d63e8b4bd 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -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 diff --git a/includes/Wiki.php b/includes/Wiki.php index 8b62139b87..2a3444eeb3 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -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 ) { -- 2.20.1