r106829 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106828‎ | r106829 | r106830 >
Date:18:20, 20 December 2011
Author:ialex
Status:deferred
Tags:
Comment:
Return the Title object or URL to redirect to the hook instead of calling $wgOut->redirect() directly. This caused the page view to be executed entirely and the redirect occured only when sending the content to the user
Modified paths:
  • /trunk/extensions/IndexFunction/IndexFunction_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/IndexFunction/IndexFunction_body.php
@@ -132,17 +132,12 @@
133133 if ( !$index ) {
134134 return true;
135135 } elseif ( $index->useSpecialPage() ) {
136 - global $wgOut;
137 -
138136 $title = SpecialPage::getTitleFor( 'Index', $title->getPrefixedText() );
139 - $wgOut->redirect( $title->getLocalURL() );
140 -
141 - return true;
 137+ } else {
 138+ $targets = $index->getTargets();
 139+ $title = $targets[0];
142140 }
143141
144 - $targets = $index->getTargets();
145 - $title = $targets[0];
146 -
147142 return false;
148143 }
149144
@@ -157,17 +152,13 @@
158153 if ( !$index ) {
159154 return true;
160155 } elseif ( $index->useSpecialPage() ) {
161 - global $wgOut;
162 -
163 - $t = SpecialPage::getTitleFor( 'Index', $title->getPrefixedText() );
164 - $wgOut->redirect( $t->getLocalURL() );
165 -
166 - return true;
 156+ $target = SpecialPage::getTitleFor( 'Index', $title->getPrefixedText() );
 157+ $target = $t->getFullURL();
 158+ } else {
 159+ $targets = $index->getTargets();
 160+ $target = $targets[0];
167161 }
168162
169 - $targets = $index->getTargets();
170 - $target = $targets[0];
171 - $article->mIsRedirect = true;
172163 $ignoreRedirect = false;
173164
174165 return true;

Status & tagging log