r106563 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106562‎ | r106563 | r106564 >
Date:14:48, 18 December 2011
Author:ialex
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Wiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -587,9 +587,9 @@
588588 Change $bad and return false to override. If an image is "bad", it is not
589589 rendered inline in wiki pages or galleries in category pages.
590590
591 -'BeforeInitialize': before anything is initialized in performRequestForTitle()
 591+'BeforeInitialize': before anything is initialized in MediaWiki::performRequest()
592592 &$title: Title being used for request
593 -&$article: The associated Article object
 593+$unused: null
594594 &$output: OutputPage object
595595 &$user: User
596596 $request: WebRequest object
Index: trunk/phase3/includes/Wiki.php
@@ -146,6 +146,9 @@
147147 $output->setPrintable();
148148 }
149149
 150+ $unused = null; // To pass it by reference
 151+ wfRunHooks( 'BeforeInitialize', array( &$title, &$unused, &$output, &$user, $request, $this ) );
 152+
150153 // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
151154 if ( is_null( $title ) || ( $title->getDBkey() == '' && $title->getInterwiki() == '' ) ||
152155 $title->isSpecial( 'Badtitle' ) )
@@ -267,8 +270,6 @@
268271 wfProfileOut( __METHOD__ );
269272 throw new MWException( "Shouldn't happen: MediaWiki::initializeArticle() returned neither an object nor a URL" );
270273 }
271 - wfRunHooks( 'BeforeInitialize',
272 - array( &$title, &$article, &$output, &$user, $request, $this ) );
273274 }
274275
275276 if ( $pageView ) {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88898Merged MediaWiki::performRequestForTitle() and MediaWiki::handleSpecialCases(...ialex16:41, 26 May 2011
r106545followup r88898 -- move BeforeInitialize hook to where it can be...mah01:46, 18 December 2011

Status & tagging log