Aaron Schulz has uploaded a new change for review.

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

Change subject: Remove DELETE_SOURCE flag from FileRepo store()/storeBatch()
......................................................................

Remove DELETE_SOURCE flag from FileRepo store()/storeBatch()

The flag is unused and adds needless complexity to already complex code.

Change-Id: I82371288730f19d408daddd1251520d34b079205
---
M includes/filerepo/FileRepo.php
1 file changed, 1 insertion(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/59/275059/1

diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php
index 789803f..6183f80 100644
--- a/includes/filerepo/FileRepo.php
+++ b/includes/filerepo/FileRepo.php
@@ -815,7 +815,6 @@
         * @param string $dstZone Destination zone
         * @param string $dstRel Destination relative path
         * @param int $flags Bitwise combination of the following flags:
-        *   self::DELETE_SOURCE     Delete the source file after upload
         *   self::OVERWRITE         Overwrite an existing destination file 
instead of failing
         *   self::OVERWRITE_SAME    Overwrite the file if the destination 
exists and has the
         *                           same contents as the source
@@ -838,7 +837,6 @@
         *
         * @param array $triplets (src, dest zone, dest rel) triplets as per 
store()
         * @param int $flags Bitwise combination of the following flags:
-        *   self::DELETE_SOURCE     Delete the source file after upload
         *   self::OVERWRITE         Overwrite an existing destination file 
instead of failing
         *   self::OVERWRITE_SAME    Overwrite the file if the destination 
exists and has the
         *                           same contents as the source
@@ -853,7 +851,6 @@
                $backend = $this->backend; // convenience
 
                $operations = [];
-               $sourceFSFilesToDelete = []; // cleanup for disk source files
                // Validate each triplet and get the store operation...
                foreach ( $triplets as $triplet ) {
                        list( $srcPath, $dstZone, $dstRel ) = $triplet;
@@ -881,12 +878,9 @@
 
                        // Get the appropriate file operation
                        if ( FileBackend::isStoragePath( $srcPath ) ) {
-                               $opName = ( $flags & self::DELETE_SOURCE ) ? 
'move' : 'copy';
+                               $opName = 'copy';
                        } else {
                                $opName = 'store';
-                               if ( $flags & self::DELETE_SOURCE ) {
-                                       $sourceFSFilesToDelete[] = $srcPath;
-                               }
                        }
                        $operations[] = [
                                'op' => $opName,
@@ -903,12 +897,6 @@
                        $opts['nonLocking'] = true;
                }
                $status->merge( $backend->doOperations( $operations, $opts ) );
-               // Cleanup for disk source files...
-               foreach ( $sourceFSFilesToDelete as $file ) {
-                       MediaWiki\suppressWarnings();
-                       unlink( $file ); // FS cleanup
-                       MediaWiki\restoreWarnings();
-               }
 
                return $status;
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82371288730f19d408daddd1251520d34b079205
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to