From 99b41790871d02d40a1b8fac35b3d80bcdf7640f Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 16 Jun 2009 01:06:13 +0000 Subject: [PATCH] Removed isMissing() calls from performance-sensitive code paths. Replaces live hack. Should hopefully avoid the total backend overload we saw when we deployed this feature initially. The feature could be reimplemented as a database field, img_missing, populated offline by a maintenance script. But doing an NFS stat() on page view is totally impossible. --- includes/ImagePage.php | 11 ++--------- includes/filerepo/File.php | 3 --- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/includes/ImagePage.php b/includes/ImagePage.php index bd14c3b31c..376199d4d2 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -451,9 +451,7 @@ class ImagePage extends Article { if($showLink) { $filename = wfEscapeWikiText( $this->displayImg->getName() ); - $medialink = $this->displayImg->isMissing() ? - "'''$filename'''" : - "[[Media:$filename|$filename]]"; + $medialink = "[[Media:$filename|$filename]]"; if( !$this->displayImg->isSafeFile() ) { $warning = wfMsgNoTrans( 'mediawarning' ); @@ -928,9 +926,6 @@ class ImageHistoryList { array( 'known', 'noclasses' ) ); $row .= ''.$url.''; - } elseif( $file->isMissing() ) { - # Don't link to missing files - $row .= $wgLang->timeAndDate( $timestamp, true ); } else { $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img ); $row .= Xml::element( 'a', array( 'href' => $url ), $wgLang->timeAndDate( $timestamp, true ) ); @@ -978,9 +973,7 @@ class ImageHistoryList { protected function getThumbForLine( $file ) { global $wgLang; - if( $file->isMissing() ) { - return '' . wfMsgHtml( 'filehist-missing' ) . ''; - } elseif( $file->allowInlineDisplay() && $file->userCan( File::DELETED_FILE ) && !$file->isDeleted( File::DELETED_FILE ) ) { + if( $file->allowInlineDisplay() && $file->userCan( File::DELETED_FILE ) && !$file->isDeleted( File::DELETED_FILE ) ) { $params = array( 'width' => '120', 'height' => '120', diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index 8d7899e502..179dab2f29 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -306,9 +306,6 @@ abstract class File { * or if it is an SVG image and SVG conversion is enabled. */ function canRender() { - if( $this->isMissing() ) { - return false; - } if ( !isset( $this->canRender ) ) { $this->canRender = $this->getHandler() && $this->handler->canRender( $this ); } -- 2.20.1