Edward Chernenko has uploaded a new change for review.

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

Change subject: Remove totally unneeded and dangerous deleteBucket() from 
AmazonS3FileBackend.
......................................................................

Remove totally unneeded and dangerous deleteBucket() from AmazonS3FileBackend.

1) The very point of doCleanInternal() is to remove directories when all files
inside of them are deleted. E.g. thumb directory when all thumbnails are gone.

In Amazon S3, directories are virtual, so there is nothing to do.
This function must be a no-op.

2) The call to deleteBucket() is a bug.

There is absolutely no point to call deleteBucket(), given that buckets are
constant (there are only four of them - public, thumb, temp, deleted), and
every single one of them will be needed in the future.

Also these buckets can have manually-defined properties or permissions
(e.g. administrator could set those in AWS Management Console),
and all those properties will be lost if the bucket is deleted and recreated.

Change-Id: Ibce052f53eb2827933a63ee1e884df6d30d39864
---
M s3/AmazonS3FileBackend.php
1 file changed, 1 insertion(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AWS 
refs/changes/79/250279/1

diff --git a/s3/AmazonS3FileBackend.php b/s3/AmazonS3FileBackend.php
index b160376..4002544 100644
--- a/s3/AmazonS3FileBackend.php
+++ b/s3/AmazonS3FileBackend.php
@@ -401,19 +401,7 @@
        }
 
        function doCleanInternal( $container, $dir, array $params ) {
-               $status = Status::newGood();
-
-               try {
-                       $this->client->deleteBucket( array(
-                               'Bucket' => $container
-                       ) );
-               } catch ( NoSuchBucketException $e ) {
-               } catch ( BucketNotEmptyException $e ) {
-               } catch ( S3Exception $e ) {
-                       $this->handleException( $e, $status, __METHOD__, 
$params );
-               }
-
-               return $status;
+               return Status::newGood();  /* Nothing to do */
        }
 
        function doPublishInternal( $container, $dir, array $params ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibce052f53eb2827933a63ee1e884df6d30d39864
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AWS
Gerrit-Branch: master
Gerrit-Owner: Edward Chernenko <[email protected]>

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

Reply via email to