From 24e610e16a22ed149585c80075ce5cf21e1757b9 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 11 Jan 2006 02:54:22 +0000 Subject: [PATCH] * Cleanup and error checking on Special:Listredirects --- RELEASE-NOTES | 1 + includes/SpecialListredirects.php | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3f9d2832a6..16eb9d0245 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -455,6 +455,7 @@ fully support the editing toolbar, but was found to be too confusing. * Skip loading of RecentChange.php except where needed * Enforce $wgSVGMaxSize when rendering, even for SVGs with a very large source size. This is necessary to limit server memory usage. +* Cleanup and error checking on Special:Listredirects === Caveats === diff --git a/includes/SpecialListredirects.php b/includes/SpecialListredirects.php index a6efb8f8bb..1ac7de48ab 100644 --- a/includes/SpecialListredirects.php +++ b/includes/SpecialListredirects.php @@ -37,15 +37,23 @@ class ListredirectsPage extends QueryPage { $rd_link = $skin->makeKnownLinkObj( $rd_title, '', 'redirect=no' ); # Find out where the redirect leads - $rd_page = new Article( &$rd_title, 0 ); - $rd_text = $rd_page->getContent( true ); # Don't follow the redirect - - # Make a link to the destination page - $tp_title = Title::newFromRedirect( $rd_text ); - $tp_link = $skin->makeKnownLinkObj( $tp_title ); + $revision = Revision::newFromTitle( $rd_title ); + if( $revision ) { + # Make a link to the destination page + $target = Title::newFromRedirect( $revision->getText() ); + if( $target ) { + $targetLink = $skin->makeKnownLinkObj( $target ); + } else { + /** @todo Put in some decent error display here */ + $targetLink = '*'; + } + } else { + /** @todo Put in some decent error display here */ + $targetLink = '*'; + } # Format the whole thing and return it - return( $rd_link . ' → ' . $tp_link ); + return( $rd_link . ' → ' . $targetLink ); } -- 2.20.1