(bug 22227) Special:Listfiles no longer throws an error on bogus file entries
authorChad Horohoe <demon@users.mediawiki.org>
Tue, 3 May 2011 19:49:20 +0000 (19:49 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Tue, 3 May 2011 19:49:20 +0000 (19:49 +0000)
RELEASE-NOTES
includes/specials/SpecialListfiles.php

index c9ccf94..8c182e6 100644 (file)
@@ -253,7 +253,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 28719) Do not call mLinkHolders __destruct explicitly
 * (bug 21196) Article::getContributors() no longer fails on PostgreSQL.
 * (bug 28752) XCache doesn't work in CLI mode.
-* (bug 28076) Thumbnail height limited to 360 pixels on Special:Listfiles 
+* (bug 28076) Thumbnail height limited to 360 pixels on Special:Listfiles
+* (bug 22227) Special:Listfiles no longer throws an error on bogus file entries
 
 === API changes in 1.18 ===
 * (bug 26339) Throw warning when truncating an overlarge API result.
index 5327e20..dacce78 100644 (file)
@@ -197,11 +197,16 @@ class ImageListPager extends TablePager {
                                if ( $imgfile === null ) $imgfile = wfMsg( 'imgfile' );
 
                                $filePage = Title::makeTitle( NS_FILE, $value );
-                               $link = $this->getSkin()->linkKnown( $filePage, htmlspecialchars( $filePage->getText() ) );
-                               $image = wfLocalFile( $value );
-                               $url = $image->getURL();
-                               $download = Xml::element('a', array( 'href' => $url ), $imgfile );
-                               return "$link ($download)";
+                               if( $filePage ) {
+                                       $link = $this->getSkin()->linkKnown( $filePage, htmlspecialchars( $filePage->getText() ) );
+                                       $download = Xml::element( 'a',
+                                               array( 'href' => wfLocalFile( $filePage )->getURL() ),
+                                               $imgfile
+                                       );
+                                       return "$link ($download)";
+                               } else {
+                                       return htmlspecialchars( $value );
+                               }
                        case 'img_user_text':
                                if ( $this->mCurrentRow->img_user ) {
                                        $link = $this->getSkin()->link(
@@ -217,7 +222,7 @@ class ImageListPager extends TablePager {
                        case 'img_description':
                                return $this->getSkin()->commentBlock( $value, null, false, false );
                        case 'count':
-                               return intval($value)+1;
+                               return intval( $value ) + 1;
                }
        }