* 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;
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__
);
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}"
__METHOD__
);
$affected = $dbw->affectedRows();
- $total = count( $this->olds );
+ $total = $this->oldcount;
$status->successCount += $affected;
$status->failCount += $total - $affected;
__METHOD__
);
$affected = $dbw->affectedRows();
- $total = count( $this->olds );
$status->successCount += $affected;
- $status->failCount += $total - $affected;
return $status;
}