r111427 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111426‎ | r111427 | r111428 >
Date:22:32, 13 February 2012
Author:werdna
Status:ok
Tags:acw-deploy, brion 
Comment:
Port (with changes) r110866 to trunk. Reviewed by Brion before commit.
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -587,6 +587,11 @@
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+'BeforeDisplayNoArticleText': before displaying noarticletext or noarticletext-nopermission
 592+at Article::showMissingArticle()
 593+
 594+$article: article object
 595+
591596 'BeforeInitialize': before anything is initialized in MediaWiki::performRequest()
592597 &$title: Title being used for request
593598 $unused: null
Index: trunk/phase3/includes/Article.php
@@ -988,6 +988,18 @@
989989 'msgKey' => array( 'moveddeleted-notice' ) )
990990 );
991991
 992+ if ( !$this->mPage->hasViewableContent() && $wgSend404Code ) {
 993+ // If there's no backing content, send a 404 Not Found
 994+ // for better machine handling of broken links.
 995+ $wgRequest->response()->header( "HTTP/1.1 404 Not Found" );
 996+ }
 997+
 998+ $hookResult = wfRunHooks( 'BeforeDisplayNoArticleText', array( $this ) );
 999+
 1000+ if ( ! $hookResult ) {
 1001+ return;
 1002+ }
 1003+
9921004 # Show error message
9931005 $oldid = $this->getOldID();
9941006 if ( $oldid ) {
@@ -1010,12 +1022,6 @@
10111023 }
10121024 $text = "<div class='noarticletext'>\n$text\n</div>";
10131025
1014 - if ( !$this->mPage->hasViewableContent() && $wgSend404Code ) {
1015 - // If there's no backing content, send a 404 Not Found
1016 - // for better machine handling of broken links.
1017 - $wgRequest->response()->header( "HTTP/1.1 404 Not Found" );
1018 - }
1019 -
10201026 $wgOut->addWikiText( $text );
10211027 }
10221028

Sign-offs

UserFlagDate
Raindriftinspected18:45, 17 February 2012

Follow-up revisions

RevisionCommit summaryAuthorDate
r111428Fix ACW to work with new hook signature introduced in r111427werdna22:38, 13 February 2012
r112850MFT r111427, r112347reedy23:14, 1 March 2012
r113040MFT r111427, r112347, r112374, r112383, r112700, r112750, r112855reedy15:15, 5 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r110866Adding a new hook - BeforeDisplayNoArticleText to core at /branches/ArticleCr...bsitu19:47, 7 February 2012

Status & tagging log