Problem/Motivation
Hello project maintainers,
This is an automated issue to help make this module compatible with Drupal 10.
To read more about this effort by the Drupal Association, please read: The project update bot is being refreshed to support Drupal 10 readiness of contributed projects
Patches will periodically be added to this issue that remove Drupal 10 deprecated API uses. To stop further patches from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD10" tag from the issue to stop the bot from posting updates.
The patches will be posted by the Project Update Bot official user account. This account will not receive any issue credit contributions for itself or any company.
Proposed resolution
You have a few options for how to use this issue:
- Accept automated patches until this issue is closed
If this issue is left open (status of Active, Needs review, Needs work or Reviewed and tested by the community) and the "ProjectUpdateBotD10" tag is left on this issue, new patches will be posted periodically if new deprecation fixes are needed.
As the Drupal Rector project improves and is able to fix more deprecated API uses, the patches posted here will cover more of the deprecated API uses in the module.
Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot patches. The bot will still post new patches then if there is a change in the new generated patch compared to the patch that the bot posted last. Those changes are then up to humans to integrate.
- Leave open but stop new automated patches.
If you want to use this issue as a starting point to remove deprecated API uses but then don't want new automated patches, remove the "ProjectUpdateBotD10" tag from the issue and use it like any other issue (the status does not matter then). If you want to receive automated patches again, add back the "ProjectUpdateBotD10" tag.
- Close it and don't use it
If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review, Needs work and Reviewed and tested by the community) and no more automated patches will be posted here.
If the issue is reopened, then new automated patches will be posted.
If you are using another issue(s) to work on Drupal 10 compatibility it would be very useful to other contributors to add those issues as "Related issues" when closing this issue.
Remaining tasks
Using the patches
- Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
- Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
- Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.
Providing feedback
If there are problems with one of the patches posted by the Project Update Bot, such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue. For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Project analysis issue queue.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | interdiff.txt | 650 bytes | slasher13 |
| #15 | flysystem_s3-d10compatibility-3297257-15.patch | 2.97 KB | slasher13 |
| #14 | interdiff.txt | 1.09 KB | slasher13 |
| #14 | flysystem_s3-d10compatibility-3297257-14.patch | 2.98 KB | slasher13 |
| #13 | interdiff.txt | 382 bytes | slasher13 |
Issue fork flysystem_s3-3297257
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
project update bot commentedThis is an automated patch generated by Drupal Rector. Please see the issue summary for more details.
It is important that any automated tests available are run with this patch and that you manually test this patch.
Drupal 10 Compatibility
According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.
Currently Drupal Rector, version 0.13.0, cannot fix all Drupal 10 compatibility problems.
This patch does not update the
info.ymlfile for Drupal 10 compatibility.Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.
Debug info
This patch was created using these packages:
Comment #3
project update bot commentedThis is an automated patch generated by Drupal Rector. Please see the issue summary for more details.
It is important that any automated tests available are run with this patch and that you manually test this patch.
Drupal 10 Compatibility
According to the Upgrade Status module, even with this patch, this module is not yet compatible with Drupal 10.
Currently Drupal Rector, version 0.13.1, cannot fix all Drupal 10 compatibility problems.
This patch does not update the
info.ymlfile for Drupal 10 compatibility.Leaving this issue open, even after committing the current patch, will allow the Project Update Bot to post additional Drupal 10 compatibility fixes as they become available in Drupal Rector.
Debug info
This patch was created using these packages:
Comment #4
project update bot commentedComment #5
mnk-0210 commentedChanged variable declaration from Protected to Public in /tests/src/Functional/ModuleInstallUninstallWebTest.php file due to Fatal Error encountered in job: https://www.drupal.org/pift-ci-job/2457239.
Also, added D10 in core requirement.
Please Review.
Comment #6
mnk-0210 commentedComment #7
mnk-0210 commentedAdded D10 in Drupal/core version of composer.json file.
Please review.
Comment #8
edmund.dunn commentedI rerolled the patch to add a couple of other fixes to @mnk-0210 's work.
Comment #9
edmund.dunn commentedThis should apply cleanly. I Hope.
Comment #10
vermario commentedhello @edmund.dunn!
I noticed that in your patch you have included changes to fix these deprecation warnings in the php-aws library:
Call to deprecated method doesObjectExist() of class Aws\S3\S3ClientInterface: Use doesObjectExistV2() insteadand
Call to deprecated method doesBucketExist() of class Aws\S3\S3Client: Use doesBucketExistV2() insteadI think there are two problems with this:
1. the new method `doesObjectExistV2` has a new parameter that we should include, so just changing the name of the function won't work.
2. The parameter has to do with "delete markers" https://docs.aws.amazon.com/AmazonS3/latest/userguide/DeleteMarker.html . Supporting this could be a good improvement for the module, but we should make a separate issue for it, so we don't introduce more changes in this one, which is about having the module support drupal 10.
For these reasons, I am including a patch that leaves the deprecated methods in place, but adds your other changes.
Comment #13
slasher13update drupal/flysystem dependency
Comment #14
slasher13_method: (OBSOLETE as of Symfony 3 see https://www.drupal.org/docs/drupal-apis/routing-system/structure-of-routes)
Comment #15
slasher13typo
Comment #16
RDLong718Hello, I see that there have been recent patches. I would like to know how far away is the Drupal 10 compatibility upgrade from being released. My organization has an upgrade project and the last module we need is flysystem s3. Is there any assistance that is needed?
Comment #17
kasey_mk commentedEDITED TO UPDATE: Thanks @Eli-T for your response. I found Patching info files with Composer which gave the tip to use the
--prefer-sourceflag on the composer require command, which then doesn't change the info file and thus allows this patch to be applied.Could the composer failures be caused by these lines? I'm on Drupal 9.5.10 and when I run
composer require 'drupal/flysystem_s3:^2.0@RC'myflysystem_s3.info.ymldoesn't look like the one I get when I git clone the module.Comment #18
eli-t@Kasey_MK it shouldn't do - those lines are added to the package when a release is created from the source code.
Comment #19
eli-tSo of the test runs failing in #3297257-15: Automated Drupal 10 compatibility fixes
PHP 8.1 & MySQL 5.7, D9.5 run-tests.sh fatal error
Not sure what's going on here; at face value, the tests don't run because the module isn't in the directory it's expected?
PHP 8.0 & MySQL 5.7, D9.5 Composer require failure (and the following two)
These tests are configured to use PHP 8.0, but presumably since these tests were configured, flysystem has bumped its minimum version of PHP to 8.1 - see https://git.drupalcode.org/project/flysystem/-/blame/2.0.x/composer.json#L8 introduced during #3361958: Drupal 9.3+ compatibility.
Comment #20
eli-tRerunning against PHP 8.1 now produces the
PHP Fatal error: Uncaught Drupal\Core\File\Exception\NotRegularDirectoryException: /var/www/html/modules/contrib/flysystem_s3 is not a directory. in /var/www/html/core/lib/Drupal/Core/File/FileSystem.php:664So I think this is the only test issue we need to fix, so long as we remember not to run tests on PHP < 8.1.
It's also worth noting that if this module wants to continue to support PHP < 8.1 on Drupal 9 going forward, we will need to fork the module and pin a dependency on flysystem 2.0.0-beta2, because the mandating of PHP 8.1 in flysystem happened on the 2.0.x branch rather than the 2.1.x branch.
Comment #21
eli-tTests do
workrun and pass locally - this is run on ddev against 2.0.x with the patch in #3297257-15: Automated Drupal 10 compatibility fixes.So something is confusing on the D.O test runner.
Comment #22
eli-tI tried to raise run the tests in the Gitlab runner (#3377065: Convert to GitlabCI) to see if they failed the same way; alas they aren't running at all for some reason; I don't know if CI is somehow disabled on Gitlab for this project, and would need a maintainer to check.
Comment #23
eli-tWe need to include the work done in #3372575: Can't see upload progress in Drupal 10 to replace jQuery once with the Drupal once library.
See change record https://www.drupal.org/node/3158256
As that was also only introduced into Drupal 9 at 9.2.0, we also need to bump the minimum version of Drupal 9 we support.
Comment #24
eli-tHave done some initial testing on Drupal 9 to make sure nothing has broken with the changes made so far, and all looks promising.
However on a standard install of Drupal after enabling the module and adding the requisite configuration to settings.php, the following error occurs on rebuilding cache:
Comment #25
eli-tLooks like the issue in #3297257-24: Automated Drupal 10 compatibility fixes is due to #3378340: Service Updating for Drupal 10 and #3376399: Support new lazy asset collection optimizers & deprecate the serve_* options.
This happens on Drupal 10.1.1
This does not happen on Drupal 10.0.10.
Note the issue is in flysystem rather than flysystem_s3, but if we merged this as stands, then people would be able to install flysystem/flysystem_s3 on Drupal 10.1.x which would then break.
Comment #26
eli-tI have tested the current state of the MR against Drupal 10.0.10 and have not found any issues.
I would very much like others to test this branch before merging it and producing a Drupal 10 compatible release.
If you are going to test it, please test against Drupal 10.0.x, not 10.1.x as we know that will not work.
Comment #27
heikkiy commentedI was testing this merge request in my project and was trying to update Drupal 9 to Drupal 10.
I needed to use a fork to get the support for composer install and I bumped into an old issue https://www.drupal.org/project/flysystem_s3/issues/2910164. The fork installed fine but all the AWS packages were missing.
This might be how composer installs the fork but probably something people might encounter when trying to upgrade projects to Drupal 10.
I defined the repositories like this in composer.json
It seems like league/flysystem-aws-s3-v3 doesn't get installed and because of that some of the dependencies are missing. The module seemed to update and work fine after I required the missing package to my project composer project.
I also tested the tip from the old issue of removing the package and reinstalling it but that didn't have the desired effect.
Comment #28
eli-t@HeikkiY thank you so much for testing.
Sounds like we might need to reopen #2910164: PHP Fatal error: Class 'Aws\Credentials\Credentials' not found and figure out all the ways that can happen.
I normally add the repo of the fork for the merge request to the repositories section of the site's composer rather than add it as a package. I'm not sure if that makes a difference.
EG
Comment #29
heikkiy commentedHi @eli-t. Thanks a lot for the quick reply.
That did indeed solve my problem. All the packages got installed now. I also tried reverting the change and the packages got uninstalled so there is definitely a difference how it installs the dependencies in how the fork is defined.
I tried the same approach in another project and it didn't install because it couldn't find a composer.json in the project. So my guess is that if the project has a composer.json in it's root, it's best to use the vcs method and if there no composer.json in the module root, then the previous approach works.
The source I used originally was https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr....
EDIT: And now that I read the fork guide again really, really slowly, I do notice that it mentions the difference is indeed the existence of composer.json in the project. I think #2910164: PHP Fatal error: Class 'Aws\Credentials\Credentials' not found can remain closed and works as designed.
Tested that I can view images in S3 and also upload new ones.
Comment #30
eli-tYeah, I found out you need the composer.json file in the module to do this recently! My take would be if there no composer.json in the module root, then add one!
Thanks again for testing, let me know how you get on.
Comment #31
heikkiy commented@eli-t, testing worked fine. I was also able to do the testing with 10.1.2. I didn't notice any errors in dlog or during my testing. I did only try uploading a couple of images and also selecting an existing image. For example image styles seemed to work fine.
There was a PHP error about #lazy_builder but that only happened before all the composer and database updates were done. So at least for me I didn't yet encounter any show stoppers regarding #3376399: Support new lazy asset collection optimizers & deprecate the serve_* options.
Are there any specific tasks or features you would like to be tested?
Comment #32
eli-tThat's interesting - are you using S3 for css and js aggregation? If not, that could be why you're not seeing any errors on 10.1.
Comment #33
heikkiy commentedNo, we are not. We are only using S3 as media file system to share files between two Drupal installations. And yes, that explains it.
Comment #34
sceefo commentedHey I had issues applying the patch. There are some minor differences between drupal.org version and git version. I made version that works on drupal.org version but for some reason I am not able to attach it. The issue seemed to be info files comments added in drupal.org.
Comment #35
eli-tHi @Sceefo!
Which patch are you trying to use, and what exact version are you trying to apply it to? I recommend using the branch in the MR. If you can't work with a branch, you can get the patch from the MR by just adding .patch onto the URL of the MR.
EG https://git.drupalcode.org/project/flysystem_s3/-/merge_requests/9.patch
Comment #36
sceefo commented@Eli-T
I was trying to add https://www.drupal.org/files/issues/2023-06-01/flysystem_s3-d10compatibi... which is uploaded in this thread to drupal/flysystem_s3 loaded with composer.
The patch you linked looks quite a different. Will get back to this one.
Comment #37
eli-tI'd suggest trying to apply against the latest head on the 2.0.x branch. There are a lot of changes in the most recent commit to do with getting gitlab CI to run tests cleanly that aren't in the latest release
Comment #38
polynya commentedI've tested the patch successfully on 9.5 but haven't tried 10 yet
Comment #39
eli-tThanks @polynya! Good to know.
Comment #40
adam-vessey commentedI've tested this out against D10, and it seems to work.
Procedure employed:
minimum-stabilitytodevprefer-stableis left astruecanonicaltofalseon each entryddev composer require "drupal/flysystem_s3:dev-3297257-automated-drupal-10 as 2.x-dev"$settings['flysystem']inweb/sites/default/settings.php(with thetest-thingscheme)ddev drush en flysystem_s3ddev drush cr('cause paranoia)ddev drush php-eval "var_dump(file_put_contents('test-thing://some-dir/file.txt', 'what'));"Output:
int(4)ddev drush php-eval "var_dump(file_get_contents('test-thing://some-dir/file.txt'));"Output:
string(4) "what"So, the write and read via PHP appears to work. Also, checked the S3 console to confirm that the file was created where it was expected, and it was. Tempted to flip this over to RTBC; however, I didn't verify the CORS functionality, so will let somebody else make the call. That said, the core read/write seems functional in D10.
Comment #41
eli-tThanks @adam-vessey 💙
I think we have enough to proceed with a release now.
Comment #42
eli-tSetting to RTBC and adding credit
Comment #44
eli-t