From e3371526ab059fb5ab8af73af084b6e46654b505 Mon Sep 17 00:00:00 2001 From: Victor Vasiliev Date: Sat, 3 May 2008 14:45:06 +0000 Subject: [PATCH] * Fix oi_deleted issues with image moving * Fix filearchive update status check --- includes/filerepo/LocalFile.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index 3409c34042..094cd7c3d6 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -1646,7 +1646,7 @@ class LocalFileRestoreBatch { * Helper class for file movement */ class LocalFileMoveBatch { - var $file, $cur, $olds, $archive, $thumbs, $target, $db; + var $file, $cur, $olds, $oldcount, $archive, $thumbs, $target, $db; function __construct( File $file, Title $target, Database $db ) { $this->file = $file; @@ -1693,9 +1693,10 @@ class LocalFileMoveBatch { function addOlds() { $archiveBase = 'archive'; $this->olds = array(); + $this->oldcount = 0; $result = $this->db->select( 'oldimage', - array( 'oi_archive_name' ), + array( 'oi_archive_name', 'oi_deleted' ), array( 'oi_name' => $this->oldName ), __METHOD__ ); @@ -1711,6 +1712,10 @@ class LocalFileMoveBatch { wfDebug( 'Invalid old file name:' . $oldName ); continue; } + $this->oldcount++; + if( $row->oi_deleted & File::DELETED_FILE ) { + continue; + } $this->olds[] = array( "{$archiveBase}/{$this->oldHash}{$oldname}", "{$archiveBase}/{$this->oldHash}{$timestamp}!{$this->newName}" @@ -1763,7 +1768,7 @@ class LocalFileMoveBatch { __METHOD__ ); $affected = $dbw->affectedRows(); - $total = count( $this->olds ); + $total = $this->oldcount; $status->successCount += $affected; $status->failCount += $total - $affected; @@ -1778,9 +1783,7 @@ class LocalFileMoveBatch { __METHOD__ ); $affected = $dbw->affectedRows(); - $total = count( $this->olds ); $status->successCount += $affected; - $status->failCount += $total - $affected; return $status; } -- 2.20.1