r79676 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79675‎ | r79676 | r79677 >
Date:22:20, 5 January 2011
Author:dantman
Status:deferred
Tags:
Comment:
Fix things up to support a wider range of titles with slightly different symbols.
Modified paths:
  • /trunk/extensions/Special404/Special404_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Special404/Special404_body.php
@@ -15,14 +15,20 @@
1616 global $wgOut, $wgRequest, $egSpecial404RedirectExistingRoots;
1717
1818 if ( $egSpecial404RedirectExistingRoots ) {
19 - $t = Title::newFromText($wgRequest->getRequestURL());
20 - if ( !is_object($t) || !$t->exists() ) {
21 - $t = Title::newFromText(trim($wgRequest->getRequestURL(), '/\\'));
 19+ $t = null;
 20+ $titles = array(
 21+ $wgRequest->getRequestURL(),
 22+ trim($wgRequest->getRequestURL(), '/\\'),
 23+ urldecode($wgRequest->getRequestURL()),
 24+ urldecode(trim($wgRequest->getRequestURL(), '/\\')),
 25+ );
 26+ foreach ( $titles as $pageTitle ) {
 27+ $t = Title::newFromText($pageTitle);
 28+ if ( is_object($t) && $t->exists() ) {
 29+ $wgOut->redirect( $t->getFullURL(), 301 );
 30+ return;
 31+ }
2232 }
23 - if ( is_object($t) && $t->exists() ) {
24 - $wgOut->redirect( $t->getFullURL(), 301 );
25 - return;
26 - }
2733 }
2834
2935 $this->setHeaders();

Status & tagging log