*/
function canRender() {
if ( !isset( $this->canRender ) ) {
- $this->canRender = $this->getHandler() && $this->handler->canRender( $this );
+ $this->canRender = $this->getHandler() && $this->handler->canRender( $this ) && $this->exists();
}
return $this->canRender;
return true;
}
+
+ /**
+ * If archive name is an empty string, then file does not "exist"
+ *
+ * This is the case for a couple files on Wikimedia servers where
+ * the old version is "lost".
+ */
+ public function exists() {
+ $archiveName = $this->getArchiveName();
+ if ( $archiveName === '' || !is_string( $archiveName ) ) {
+ return false;
+ }
+ return parent::exists();
+ }
}
$url = $lang->userTimeAndDate( $timestamp, $user );
}
$row .= '<span class="history-deleted">' . $url . '</span>';
+ } elseif ( !$file->exists() ) {
+ $row .= '<span class="mw-file-missing">'
+ . $lang->userTimeAndDate( $timestamp, $user ) . '</span>';
} else {
$url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img );
$row .= Xml::element(