r85231 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85230‎ | r85231 | r85232 >
Date:06:26, 3 April 2011
Author:dantman
Status:ok (Comments)
Tags:
Comment:
Followup r85227; Back out changes related to avoiding calls to OutputPage from includable special pages. After some re-examination we replace the OutputPage and OutputPage is coded in a way to avoid poluting global things with things like the use of header(); in set* calls, so setting things on OutputPage while in an includable special page just gets discarded.
Modified paths:
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialAllpages.php
@@ -64,7 +64,7 @@
6565
6666 $this->setHeaders();
6767 $this->outputHeader();
68 - $this->allowClickjacking();
 68+ $out->allowClickjacking();
6969
7070 # GET values
7171 $from = $request->getVal( 'from', null );
@@ -73,17 +73,12 @@
7474
7575 $namespaces = $wgContLang->getNamespaces();
7676
77 - if( !$this->including() ) {
78 - $out->setPagetitle(
79 - ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces) ) ) ?
80 - wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) :
81 - wfMsg( 'allarticles' )
82 - );
83 - // Note: The following will not end up in the parser output cache as
84 - // a result even if we wanted to load it on pages including the
85 - // special page it would be unstable.
86 - $out->addModuleStyles( 'mediawiki.special' );
87 - }
 77+ $out->setPagetitle(
 78+ ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces) ) ) ?
 79+ wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) :
 80+ wfMsg( 'allarticles' )
 81+ );
 82+ $out->addModuleStyles( 'mediawiki.special' );
8883
8984 if( isset($par) ) {
9085 $this->showChunk( $namespace, $par, $to );
Index: trunk/phase3/includes/SpecialPage.php
@@ -547,12 +547,10 @@
548548 $page = SpecialPage::getPageByAlias( $name );
549549 # Nonexistent?
550550 if ( !$page ) {
551 - if ( !$including ) {
552 - $wgOut->setArticleRelated( false );
553 - $wgOut->setRobotPolicy( 'noindex,nofollow' );
554 - $wgOut->setStatusCode( 404 );
555 - $wgOut->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
556 - }
 551+ $wgOut->setArticleRelated( false );
 552+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
 553+ $wgOut->setStatusCode( 404 );
 554+ $wgOut->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' );
557555 wfProfileOut( __METHOD__ );
558556 return false;
559557 }
@@ -877,10 +875,6 @@
878876 * Sets headers - this should be called from the execute() method of all derived classes!
879877 */
880878 function setHeaders() {
881 - if ( $this->including() ) {
882 - // Don't set these headers when special page is being included into an article
883 - return;
884 - }
885879 $out = $this->getOutput();
886880 $out->setArticleRelated( false );
887881 $out->setRobotPolicy( "noindex,nofollow" );
@@ -1055,16 +1049,6 @@
10561050 }
10571051
10581052 /**
1059 - * Shortcut to call OutputPage::allowClickjacking(); which also takes
1060 - * transclusion into account.
1061 - */
1062 - public function allowClickjacking() {
1063 - if ( !$this->including() ) {
1064 - $this->getOutput()->allowClickjacking();
1065 - }
1066 - }
1067 -
1068 - /**
10691053 * Wrapper around wfMessage that sets the current context. Currently this
10701054 * is only the title.
10711055 *

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85227Start managing output and input context from special pages themselves instead...dantman04:36, 3 April 2011
r85229Followup r85227. Convert all IncludableSpecialPages to use context properly (...dantman05:46, 3 April 2011

Comments

#Comment by Nikerabbit (talk | contribs)   15:20, 3 April 2011

Follow-up in the summary is wrong.

#Comment by Aaron Schulz (talk | contribs)   03:23, 28 June 2011

Reverts some of r85229.

Status & tagging log