Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173098

Change subject: Removed some unnecessary code in LocalFileDeleteBatch
......................................................................

Removed some unnecessary code in LocalFileDeleteBatch

Change-Id: I4d03d03fada5c299779b7fb7e998285568672a6c
---
M includes/filerepo/file/LocalFile.php
1 file changed, 3 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/98/173098/1

diff --git a/includes/filerepo/file/LocalFile.php 
b/includes/filerepo/file/LocalFile.php
index 9f14669..35a0eb5 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -2243,23 +2243,7 @@
                wfProfileIn( __METHOD__ );
 
                $this->file->lock();
-               // Leave private files alone
-               $privateFiles = array();
-               list( $oldRels, ) = $this->getOldRels();
-               $dbw = $this->file->repo->getMasterDB();
 
-               if ( !empty( $oldRels ) ) {
-                       $res = $dbw->select( 'oldimage',
-                               array( 'oi_archive_name' ),
-                               array( 'oi_name' => $this->file->getName(),
-                                       'oi_archive_name' => array_keys( 
$oldRels ),
-                                       $dbw->bitAnd( 'oi_deleted', 
File::DELETED_FILE ) => File::DELETED_FILE ),
-                               __METHOD__ );
-
-                       foreach ( $res as $row ) {
-                               $privateFiles[$row->oi_archive_name] = 1;
-                       }
-               }
                // Prepare deletion batch
                $hashes = $this->getHashes();
                $this->deletionBatch = array();
@@ -2267,9 +2251,8 @@
                $dotExt = $ext === '' ? '' : ".$ext";
 
                foreach ( $this->srcRels as $name => $srcRel ) {
-                       // Skip files that have no hash (missing source).
-                       // Keep private files where they are.
-                       if ( isset( $hashes[$name] ) && !array_key_exists( 
$name, $privateFiles ) ) {
+                       // Skip files that have no hash (e.g. missing DB record 
and source)
+                       if ( isset( $hashes[$name] ) ) {
                                $hash = $hashes[$name];
                                $key = $hash . $dotExt;
                                $dstRel = 
$this->file->repo->getDeletedHashPath( $key ) . $key;
@@ -2286,6 +2269,7 @@
                $this->doDBInserts();
 
                // Removes non-existent file from the batch, so we don't get 
errors.
+               // This also caches files in the 'deleted' zone deleted via 
revision deletion.
                $checkStatus = $this->removeNonexistentFiles( 
$this->deletionBatch );
                if ( !$checkStatus->isGood() ) {
                        $this->status->merge( $checkStatus );

-- 
To view, visit https://gerrit.wikimedia.org/r/173098
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d03d03fada5c299779b7fb7e998285568672a6c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to