From 8dfe81f7546853883caf942fbd2eefebdc424364 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 3 May 2011 19:49:20 +0000 Subject: [PATCH] (bug 22227) Special:Listfiles no longer throws an error on bogus file entries --- RELEASE-NOTES | 3 ++- includes/specials/SpecialListfiles.php | 17 +++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c9ccf94da7..8c182e6eec 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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. diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index 5327e203e4..dacce789ed 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -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; } } -- 2.20.1