From c72d0b93c54c547ebf4aaddd62606b3302c72975 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 8 Nov 2008 01:58:18 +0000 Subject: [PATCH] Make sure the top rev is not hidden --- includes/filerepo/LocalFile.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index 49528a3159..25a9e39435 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -1519,7 +1519,8 @@ class LocalFileRestoreBatch { $result = $dbw->select( 'filearchive', '*', $conditions, __METHOD__, - array( 'ORDER BY' => 'fa_timestamp DESC' ) ); + array( 'ORDER BY' => 'fa_timestamp DESC' ) + ); $idsPresent = array(); $storeBatch = array(); @@ -1564,15 +1565,11 @@ class LocalFileRestoreBatch { 'minor_mime' => $row->fa_minor_mime, 'major_mime' => $row->fa_major_mime, 'media_type' => $row->fa_media_type, - 'metadata' => $row->fa_metadata ); + 'metadata' => $row->fa_metadata + ); } if ( $first && !$exists ) { - // The live (current) version cannot be hidden! - if( !$this->unsuppress && $row->fa_deleted ) { - $this->file->unlock(); - return $status; - } // This revision will be published as the new current version $destRel = $this->file->getRel(); $insertCurrent = array( @@ -1589,7 +1586,13 @@ class LocalFileRestoreBatch { 'img_user' => $row->fa_user, 'img_user_text' => $row->fa_user_text, 'img_timestamp' => $row->fa_timestamp, - 'img_sha1' => $sha1); + 'img_sha1' => $sha1 + ); + // The live (current) version cannot be hidden! + if( !$this->unsuppress && $row->fa_deleted ) { + $storeBatch[] = array( $deletedUrl, 'public', $destRel ); + $this->cleanupBatch[] = $row->fa_storage_key; + } } else { $archiveName = $row->fa_archive_name; if( $archiveName == '' ) { -- 2.20.1