(bug 5817) Appropriate handling for Special:Recentchangeslinked where the target...
authorRob Church <robchurch@users.mediawiki.org>
Wed, 3 May 2006 18:54:28 +0000 (18:54 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Wed, 3 May 2006 18:54:28 +0000 (18:54 +0000)
RELEASE-NOTES
includes/SpecialRecentchangeslinked.php

index f09a477..5d14c60 100644 (file)
@@ -194,6 +194,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Clean up Special:Listusers; add an "(all)" label to the group selection box
 * (bug 5812) Use appropriate link colour in Special:Mostlinked
 * (bug 5802) {{CURRENTMONTHNAME}} variable broken in Vietnamese locale
+* (bug 5817) Appropriate handling for Special:Recentchangeslinked where the target
+  page doesn't exist
 
 == Compatibility ==
 
index 79654b5..aab5e49 100644 (file)
@@ -25,15 +25,20 @@ function wfSpecialRecentchangeslinked( $par = NULL ) {
        $wgOut->setPagetitle( wfMsg( 'recentchangeslinked' ) );
        $sk = $wgUser->getSkin();
 
-       if (is_null($target)) {
-               $wgOut->errorpage( 'notargettitle', 'notargettext' );
+       # Validate the title
+       $nt = Title::newFromURL( $target );
+       if( !is_object( $nt ) ) {
+               $wgOut->errorPage( 'notargettitle', 'notargettext' );
                return;
        }
-       $nt = Title::newFromURL( $target );
-       if( !$nt ) {
-               $wgOut->errorpage( 'notargettitle', 'notargettext' );
+       
+       # Check for existence
+       # Do a quiet redirect back to the page itself if it doesn't
+       if( !$nt->exists() ) {
+               $wgOut->redirect( $nt->getLocalUrl() );
                return;
        }
+
        $id = $nt->getArticleId();
 
        $wgOut->setSubtitle( htmlspecialchars( wfMsg( 'rclsub', $nt->getPrefixedText() ) ) );