From: Rob Church Date: Wed, 3 May 2006 18:54:28 +0000 (+0000) Subject: (bug 5817) Appropriate handling for Special:Recentchangeslinked where the target... X-Git-Tag: 1.31.0-rc.0~57255 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=421110282122bb841f6ec6217d60e1b0887dd492;p=lhc%2Fweb%2Fwiklou.git (bug 5817) Appropriate handling for Special:Recentchangeslinked where the target page doesn't exist --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f09a477074..5d14c60d72 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/SpecialRecentchangeslinked.php b/includes/SpecialRecentchangeslinked.php index 79654b58e7..aab5e49fc2 100644 --- a/includes/SpecialRecentchangeslinked.php +++ b/includes/SpecialRecentchangeslinked.php @@ -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() ) ) );