-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$client->uploadDirectory() always uploads every file, even when no changes #1959
Comments
could it be a permissions issue? |
To answer the question above, it is not a permissions issue. I added administrator rights to the user and the outcome is the same. |
Hi @curtiscarlson, thanks for reaching out to us. It sounds like you're expecting Instead, |
@diehlaws Thank you for your response. Are you sure though? This page: https://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-s3.html states "The uploadDirectory() method of a client will compare the contents of the local directory to the contents in the Amazon S3 bucket and only transfer files that have changed. " The page also explains that the function takes an options array, one of which is 'force', defined as "Set to true to upload every file, even if the file is already in Amazon S3 and has not changed." Which implies that the default is false. I have tried setting this option to false manually and it doesn't do anything. Finally, the page explains that "The uploadDirectory() method is an abstraction layer over the much more powerful Aws\S3\Sync\UploadSyncBuilder". Which means to imply that it is indeed similar to the s3 sync command. (It is also all under the "Syncing data with Amazon S3" heading). Thanks again. |
No problem! The documentation page you mentioned is for version 2 of the AWS SDK for PHP. It looks like this function was changed with the release of version 3 of the AWS SDK for PHP so that, instead of iterating through existing objects in the destination bucket/prefix to only copy new and changed files from the local directory, it copies the full contents of the given directory regardless of the contents of the destination. Unfortunately it does not look like a new function was ever created in V3 to implement the functionality present in the V2 S3Client's That being said, you can provide an iterator to the S3 Transfer's constructor method to then call its |
@diehlaws I think both of your suggestions are probably over my head. I tried to find the V2 code on github but I would have to click for hours to get back that far. I want to say that I think this functionality is extremely important and that you should reconsider its priority, for the following reasons
If you point me in the right direction to the original code I might be able to make the contribution but as I said I might be over my head. Thank you. |
Thanks for the feedack @curtiscarlson! I've marked the issue as a feature request and will bring it up with the rest of the team in the next team sprint. You can review the code for V2 of the SDK by switching branches in this repo from |
Any update on this issue |
@alexwai |
Very disappointed that this was removed in v3. We upload hundreds of files every 30 minutes. |
Hi all, We've had a number of conversations about this as a team and we've decided that the PHP SDK will not be implementing this feature. At least until the SDKs have settled on a shared specification of a sync-like customization. Closing for now, but happy to answer any questions you might have. |
|
Please fill out the sections below to help us address your issue.
Version of AWS SDK for PHP?
3.133.5
Version of PHP (
php -v
)?PHP 7.2.21
What issue did you see?
when running uploadDirectory(), it creates a new version of every file in the folder
Steps to reproduce
If you have a runnable example, please include it as a snippet or link to a repository/gist for larger code examples.
No, just the basic function with a local source folder and a bucket destination, no other options or arguments
Additional context
Any additional information relevant to the issue. Examples include any framework you may be using (e.g. Laravel, Wordpress) in conjunction with the AWS SDK for PHP, or PHP/environment config settings if the issue is related to memory or performance.
windows / xampp
using slim/pimple and env, my setup looks like this
Symfony console command:
The text was updated successfully, but these errors were encountered: