From 654abcb539a2f12ef93be8b0ccbd0cb454a86d65 Mon Sep 17 00:00:00 2001 From: Daniel Friesen Date: Sun, 3 Apr 2011 06:26:58 +0000 Subject: [PATCH] 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. --- includes/SpecialPage.php | 24 ++++-------------------- includes/specials/SpecialAllpages.php | 19 +++++++------------ 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 10a016bcb9..6bd224eadc 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -547,12 +547,10 @@ class SpecialPage { $page = SpecialPage::getPageByAlias( $name ); # Nonexistent? if ( !$page ) { - if ( !$including ) { - $wgOut->setArticleRelated( false ); - $wgOut->setRobotPolicy( 'noindex,nofollow' ); - $wgOut->setStatusCode( 404 ); - $wgOut->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' ); - } + $wgOut->setArticleRelated( false ); + $wgOut->setRobotPolicy( 'noindex,nofollow' ); + $wgOut->setStatusCode( 404 ); + $wgOut->showErrorPage( 'nosuchspecialpage', 'nospecialpagetext' ); wfProfileOut( __METHOD__ ); return false; } @@ -877,10 +875,6 @@ class SpecialPage { * Sets headers - this should be called from the execute() method of all derived classes! */ function setHeaders() { - if ( $this->including() ) { - // Don't set these headers when special page is being included into an article - return; - } $out = $this->getOutput(); $out->setArticleRelated( false ); $out->setRobotPolicy( "noindex,nofollow" ); @@ -1054,16 +1048,6 @@ class SpecialPage { return $this->getOutput()->getSkin(); } - /** - * Shortcut to call OutputPage::allowClickjacking(); which also takes - * transclusion into account. - */ - public function allowClickjacking() { - if ( !$this->including() ) { - $this->getOutput()->allowClickjacking(); - } - } - /** * Wrapper around wfMessage that sets the current context. Currently this * is only the title. diff --git a/includes/specials/SpecialAllpages.php b/includes/specials/SpecialAllpages.php index bb4c1d7384..ec049ac55a 100644 --- a/includes/specials/SpecialAllpages.php +++ b/includes/specials/SpecialAllpages.php @@ -64,7 +64,7 @@ class SpecialAllpages extends IncludableSpecialPage { $this->setHeaders(); $this->outputHeader(); - $this->allowClickjacking(); + $out->allowClickjacking(); # GET values $from = $request->getVal( 'from', null ); @@ -73,17 +73,12 @@ class SpecialAllpages extends IncludableSpecialPage { $namespaces = $wgContLang->getNamespaces(); - if( !$this->including() ) { - $out->setPagetitle( - ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces) ) ) ? - wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) : - wfMsg( 'allarticles' ) - ); - // Note: The following will not end up in the parser output cache as - // a result even if we wanted to load it on pages including the - // special page it would be unstable. - $out->addModuleStyles( 'mediawiki.special' ); - } + $out->setPagetitle( + ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces) ) ) ? + wfMsg( 'allinnamespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) : + wfMsg( 'allarticles' ) + ); + $out->addModuleStyles( 'mediawiki.special' ); if( isset($par) ) { $this->showChunk( $namespace, $par, $to ); -- 2.20.1