Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -587,6 +587,11 @@ |
588 | 588 | Change $bad and return false to override. If an image is "bad", it is not |
589 | 589 | rendered inline in wiki pages or galleries in category pages. |
590 | 590 | |
| 591 | +'BeforeDisplayNoArticleText': before displaying noarticletext or noarticletext-nopermission |
| 592 | +at Article::showMissingArticle() |
| 593 | + |
| 594 | +$article: article object |
| 595 | + |
591 | 596 | 'BeforeInitialize': before anything is initialized in MediaWiki::performRequest() |
592 | 597 | &$title: Title being used for request |
593 | 598 | $unused: null |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -988,6 +988,18 @@ |
989 | 989 | 'msgKey' => array( 'moveddeleted-notice' ) ) |
990 | 990 | ); |
991 | 991 | |
| 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 | + |
992 | 1004 | # Show error message |
993 | 1005 | $oldid = $this->getOldID(); |
994 | 1006 | if ( $oldid ) { |
— | — | @@ -1010,12 +1022,6 @@ |
1011 | 1023 | } |
1012 | 1024 | $text = "<div class='noarticletext'>\n$text\n</div>"; |
1013 | 1025 | |
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 | | - |
1020 | 1026 | $wgOut->addWikiText( $text ); |
1021 | 1027 | } |
1022 | 1028 | |