* Cleanup and error checking on Special:Listredirects
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 11 Jan 2006 02:54:22 +0000 (02:54 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 11 Jan 2006 02:54:22 +0000 (02:54 +0000)
RELEASE-NOTES
includes/SpecialListredirects.php

index 3f9d283..16eb9d0 100644 (file)
@@ -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 ===
index a6efb8f..1ac7de4 100644 (file)
@@ -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 . ' &rarr; ' . $tp_link );
+               return( $rd_link . ' &rarr; ' . $targetLink );
 
        }