Automated Drupal 10 compatibility fixes

Created on 18 July 2022, over 2 years ago
Updated 12 October 2023, about 1 year ago

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:

  1. 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.

  2. 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.

  3. 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

  1. Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
  3. 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 .

📌 Task
Status

Fixed

Version

2.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Changed 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.

  • Added D10 in Drupal/core version of composer.json file.

    Please review.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    run-tests.sh fatal error
  • 🇺🇸United States edmund.dunn Olympia, WA

    I rerolled the patch to add a couple of other fixes to @mnk-0210 's work.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Patch Failed to Apply
  • 🇺🇸United States edmund.dunn Olympia, WA

    This should apply cleanly. I Hope.

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    run-tests.sh fatal error
  • 🇫🇮Finland vermario

    @edmund.dunn

    I noticed that in your patch you have included changes to fix these deprecation warning:

    Call to deprecated method doesObjectExist() of class Aws\S3\S3ClientInterface: Use doesObjectExistV2() instead

    and
    Call to deprecated method doesBucketExist() of class Aws\S3\S3Client: Use doesBucketExistV2() instead

    I 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.

  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    run-tests.sh fatal error
  • @j_ten_man opened merge request.
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Composer require failure
  • 🇩🇪Germany slasher13

    update drupal/flysystem dependency

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    run-tests.sh fatal error
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    run-tests.sh fatal error
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    run-tests.sh fatal error
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    run-tests.sh fatal error
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Composer require failure
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Composer require failure
  • 🇺🇸United States RDLong718

    Hello, 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?

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Composer require failure
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Composer require failure
  • 🇺🇸United States Kasey_MK

    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'` my `flysystem_s3.info.yml` doesn't look like the one I get when I git clone the module.

    # version: 8.0-dev

    # Information added by Drupal.org packaging script on 2022-03-25
    version: '2.0.0-rc5'
    project: 'flysystem_s3'
    datestamp: 1648207248

  • 🇬🇧United Kingdom Eli-T Manchester

    @Kasey_MK it shouldn't do - those lines are added to the package when a release is created from the source code.

  • 🇬🇧United Kingdom Eli-T Manchester

    So 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 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:664
    Stack trace:
    #0 /var/www/html/core/scripts/run-tests.sh(1106): Drupal\Core\File\FileSystem->scanDirectory('/var/www/html/m...', '/\\.php$/', Array)
    #1 /var/www/html/core/scripts/run-tests.sh(161): simpletest_script_get_test_list()
    #2 {main}
      thrown in /var/www/html/core/lib/Drupal/Core/File/FileSystem.php on line 664

    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 📌 Drupal 9.3+ compatibility Fixed .

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    run-tests.sh fatal error
  • Status changed to Needs work over 1 year ago
  • 🇬🇧United Kingdom Eli-T Manchester

    Rerunning 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:664

    So 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.

  • 🇬🇧United Kingdom Eli-T Manchester

    Tests do work 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.

    elliot.ward@d9test-web:/var/www/html/web/core$ ../../vendor/bin/phpunit ../modules/contrib/flysystem_s3
    PHPUnit 9.6.10 by Sebastian Bergmann and contributors.
    
    Warning:       Your XML configuration validates against a deprecated schema.
    Suggestion:    Migrate your XML configuration using "--migrate-configuration"!
    
    Testing /var/www/html/web/modules/contrib/flysystem_s3
    ..........                                                        10 / 10 (100%)
    
    Time: 00:06.724, Memory: 14.00 MB
    
    OK (10 tests, 27 assertions)
    elliot.ward@d9test-web:/var/www/html/web/core$ drush st | grep version
    Drupal version : 9.5.10
    PHP version    : 8.1.16
    Drush version  : 11.6.0
  • 🇬🇧United Kingdom Eli-T Manchester

    I tried to raise run the tests in the Gitlab runner ( 📌 Convert to GitlabCI Fixed ) 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.

  • 🇬🇧United Kingdom Eli-T Manchester

    We need to include the work done in 🐛 Can't see upload progress in Drupal 10 Closed: duplicate 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.

  • 🇬🇧United Kingdom Eli-T Manchester

    Have 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:

    ❰elliot.ward❙~/code/d10test/recommended-project❱✘≻ ddev drush si standard
     You are about to:
     * DROP all tables in your 'db' database.
    
     Do you want to continue? (yes/no) [yes]:
     > yes
    
     [notice] Starting Drupal installation. This takes a while.
     [notice] Performed install task: install_select_language
     [notice] Performed install task: install_select_profile
     [notice] Performed install task: install_load_profile
     [notice] Performed install task: install_verify_requirements
     [notice] Performed install task: install_verify_database_ready
     [notice] Performed install task: install_base_system
     [notice] Performed install task: install_bootstrap_full
     [notice] Performed install task: install_profile_modules
     [notice] Performed install task: install_profile_themes
     [notice] Performed install task: install_install_profile
     [notice] Performed install task: install_configure_form
     [notice] Performed install task: install_finished
     [success] Installation complete.  User name: admin  User password: xxxxxxxx
    ❰elliot.ward❙~/code/d10test/recommended-project❱✔≻ ddev drush cr
     [notice] The file assets://css was not deleted because it does not exist.
     [success] Cache rebuild complete.
    ❰elliot.ward❙~/code/d10test/recommended-project❱✔≻ ddev drush cr
     [notice] The file assets://css was not deleted because it does not exist.
     [notice] The file assets://js was not deleted because it does not exist.
     [success] Cache rebuild complete.
    ❰elliot.ward❙~/code/d10test/recommended-project❱✔≻ ddev drush en flysystem_s3
    The following module(s) will be enabled: flysystem_s3, flysystem
    
     Do you want to continue? (yes/no) [yes]:
     > yes
    
     [error]  The Flysystem driver is missing.
     [error]  The Flysystem driver is missing.
     [success] Successfully enabled: flysystem_s3, flysystem
    ❰elliot.ward❙~/code/d10test/recommended-project❱✔≻ ddev drush cr
     [error]  TypeError: Drupal\Core\Asset\JsCollectionOptimizer::__construct(): Argument #3 ($dumper) must be of type Drupal\Core\Asset\AssetDumperInterface, Drupal\Core\Theme\ThemeManager given, called in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\Core\Asset\JsCollectionOptimizer->__construct() (line 69 of /var/www/html/web/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php) #0 /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\Core\Asset\JsCollectionOptimizer->__construct(Object(Drupal\Core\Asset\JsCollectionGrouper), Object(Drupal\Core\Asset\JsOptimizer), Object(Drupal\Core\Theme\ThemeManager), Object(Drupal\Core\Asset\LibraryDependencyResolver), Object(Symfony\Component\HttpFoundation\RequestStack), Object(Drupal\flysystem_s3\File\FlysystemS3FileSystem), Object(Drupal\Core\Config\ConfigFactory), Object(Drupal\Core\File\FileUrlGenerator), Object(Drupal\Component\Datetime\Time), Object(Drupal\Core\Language\LanguageManager), Object(Drupal\Core\State\State))
    #1 /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'asset.js.collec...')
    #2 /var/www/html/vendor/drush/drush/src/Commands/core/CacheCommands.php(61): Drupal\Component\DependencyInjection\Container->get('asset.js.collec...')
    #3 /var/www/html/vendor/drush/drush/src/Runtime/ServiceManager.php(321): Drush\Commands\core\CacheCommands::create(Object(Drupal\Core\DependencyInjection\Container), Object(League\Container\Container))
    #4 /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php(310): Drush\Runtime\ServiceManager->instantiateServices(Array, Object(League\Container\Container), Object(Drupal\Core\DependencyInjection\Container))
    #5 /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php(238): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands(Object(Drush\Boot\BootstrapManager))
    #6 /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php(236): Drush\Boot\DrupalBoot8->bootstrapDrupalFull(Object(Drush\Boot\BootstrapManager), NULL)
    #7 /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php(422): Drush\Boot\BootstrapManager->doBootstrap(5, 6, NULL)
    #8 /var/www/html/vendor/drush/drush/src/Application.php(228): Drush\Boot\BootstrapManager->bootstrapMax()
    #9 /var/www/html/vendor/drush/drush/src/Application.php(194): Drush\Application->bootstrapAndFind('cr')
    #10 /var/www/html/vendor/symfony/console/Application.php(262): Drush\Application->find('cr')
    #11 /var/www/html/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #12 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #13 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
    #14 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
    #15 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
    #16 /var/www/html/vendor/bin/drush(120): include('/var/www/html/v...')
    #17 {main}.
    TypeError: Drupal\Core\Asset\JsCollectionOptimizer::__construct(): Argument #3 ($dumper) must be of type Drupal\Core\Asset\AssetDumperInterface, Drupal\Core\Theme\ThemeManager given, called in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in /var/www/html/web/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php on line 69 #0 /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\Core\Asset\JsCollectionOptimizer->__construct(Object(Drupal\Core\Asset\JsCollectionGrouper), Object(Drupal\Core\Asset\JsOptimizer), Object(Drupal\Core\Theme\ThemeManager), Object(Drupal\Core\Asset\LibraryDependencyResolver), Object(Symfony\Component\HttpFoundation\RequestStack), Object(Drupal\flysystem_s3\File\FlysystemS3FileSystem), Object(Drupal\Core\Config\ConfigFactory), Object(Drupal\Core\File\FileUrlGenerator), Object(Drupal\Component\Datetime\Time), Object(Drupal\Core\Language\LanguageManager), Object(Drupal\Core\State\State))
    #1 /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'asset.js.collec...')
    #2 /var/www/html/vendor/drush/drush/src/Commands/core/CacheCommands.php(61): Drupal\Component\DependencyInjection\Container->get('asset.js.collec...')
    #3 /var/www/html/vendor/drush/drush/src/Runtime/ServiceManager.php(321): Drush\Commands\core\CacheCommands::create(Object(Drupal\Core\DependencyInjection\Container), Object(League\Container\Container))
    #4 /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php(310): Drush\Runtime\ServiceManager->instantiateServices(Array, Object(League\Container\Container), Object(Drupal\Core\DependencyInjection\Container))
    #5 /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php(238): Drush\Boot\DrupalBoot8->addDrupalModuleDrushCommands(Object(Drush\Boot\BootstrapManager))
    #6 /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php(236): Drush\Boot\DrupalBoot8->bootstrapDrupalFull(Object(Drush\Boot\BootstrapManager), NULL)
    #7 /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php(422): Drush\Boot\BootstrapManager->doBootstrap(5, 6, NULL)
    #8 /var/www/html/vendor/drush/drush/src/Application.php(228): Drush\Boot\BootstrapManager->bootstrapMax()
    #9 /var/www/html/vendor/drush/drush/src/Application.php(194): Drush\Application->bootstrapAndFind('cr')
    #10 /var/www/html/vendor/symfony/console/Application.php(262): Drush\Application->find('cr')
    #11 /var/www/html/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #12 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #13 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
    #14 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
    #15 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
    #16 /var/www/html/vendor/bin/drush(120): include('/var/www/html/v...')
    #17 {main}
    TypeError: Drupal\Core\Asset\JsCollectionOptimizer::__construct(): Argument #3 ($dumper) must be of type Drupal\Core\Asset\AssetDumperInterface, Drupal\Core\Theme\ThemeManager given, called in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\Core\Asset\JsCollectionOptimizer->__construct() (line 69 of /var/www/html/web/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php).
     [warning] Drush command terminated abnormally.
    Failed to run drush cr: exit status 1
  • 🇬🇧United Kingdom Eli-T Manchester

    Looks like the issue in #3297257-24: Automated Drupal 10 compatibility fixes is due to 🐛 Service Updating for Drupal 10 Closed: duplicate and 📌 Support new lazy asset collection optimizers & deprecate the serve_* options Needs review .

    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.

  • Status changed to Needs review over 1 year ago
  • 🇬🇧United Kingdom Eli-T Manchester

    I 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.

  • 🇫🇮Finland heikkiy Oulu

    I 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

    {
        "type": "composer",
        "url": "https://packages.drupal.org/8"
    },
    {
        "type": "package",
        "package": {
            "name": "drupal/flysystem_s3",
            "version": "dev-3297257-automated-drupal-10",
            "type": "drupal-module",
            "source": {
                "type": "git",
                "url": "https://git.drupalcode.org/issue/flysystem_s3-3297257.git",
                "reference": "3297257-automated-drupal-10"
            }
        }
    },
    ...
    "drupal/flysystem_s3": "dev-3297257-automated-drupal-10",
    

    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.

  • 🇬🇧United Kingdom Eli-T Manchester

    @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

    "repositories": [
      {
        "type": "vcs
        "url": "https://git.drupalcode.org/issue/flysystem_s3-3297257.git"
      },
      {
        "type": "composer",
        "url": "https://packages.drupal.org/8"
      },
    ],
    "require": {
      drupal/flysystem–s3: "dev-3297257-automated-drupal-10"
    },
  • 🇫🇮Finland heikkiy Oulu

    Hi @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... .

  • 🇬🇧United Kingdom Eli-T Manchester

    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.

    Yeah, 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.

  • 🇫🇮Finland heikkiy Oulu

    @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 📌 Support new lazy asset collection optimizers & deprecate the serve_* options Needs review .

    Are there any specific tasks or features you would like to be tested?

  • 🇬🇧United Kingdom Eli-T Manchester

    That'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.

  • 🇫🇮Finland heikkiy Oulu

    No, we are not. We are only using S3 as media file system to share files between two Drupal installations. And yes, that explains it.

  • 🇫🇮Finland sceefo

    Hey 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.

    diff --git a/composer.json b/composer.json
    index 20f49c5..b0268ff 100644
    --- a/composer.json
    +++ b/composer.json
    @@ -1,9 +1,9 @@
     {
       "name": "drupal/flysystem_s3",
       "require": {
    -    "drupal/flysystem": "^2.0",
    +    "drupal/flysystem": "^2.1@rc",
         "league/flysystem": "^1.0.20",
         "league/flysystem-aws-s3-v3": "^1.0, !=1.0.12, !=1.0.13",
    -    "drupal/core": "^9.0"
    +    "drupal/core": "^9 || ^10"
       }
     }
    diff --git a/flysystem_s3.info.yml b/flysystem_s3.info.yml
    index ba73fc3..4f38efc 100644
    --- a/flysystem_s3.info.yml
    +++ b/flysystem_s3.info.yml
    @@ -1,11 +1,11 @@
     name: Flysystem Amazon S3
     description: 'Provides an Amazon S3 plugin for Flysystem.'
     type: module
    -core_version_requirement: ^9
    +core_version_requirement: ^9 || ^10.0
     # version: 8.0-dev
     package: Flysystem
     dependencies:
    - - flysystem:flysystem
    +  - flysystem:flysystem
     
     # Information added by Drupal.org packaging script on 2022-03-25
     version: '2.0.0-rc5'
    diff --git a/flysystem_s3.routing.yml b/flysystem_s3.routing.yml
    index 0bc1cb8..2d271a2 100644
    --- a/flysystem_s3.routing.yml
    +++ b/flysystem_s3.routing.yml
    @@ -4,11 +4,11 @@ flysystem_s3.cors_sign:
         _controller: 'Drupal\flysystem_s3\Controller\S3CorsUploadAjaxController::signRequest'
       requirements:
         _permission: 'use S3 CORS upload'
    -    _method: 'POST'
    +  methods: [POST]
     flysystem_s3.cors_save:
       path: '/flysystem-s3/cors-upload-save'
       defaults:
         _controller: 'Drupal\flysystem_s3\Controller\S3CorsUploadAjaxController::saveFile'
       requirements:
         _permission: 'use S3 CORS upload'
    -    _method: 'POST'
    +  methods: [POST]
    diff --git a/flysystem_s3.services.yml b/flysystem_s3.services.yml
    index e36dc60..f209a3f 100644
    --- a/flysystem_s3.services.yml
    +++ b/flysystem_s3.services.yml
    @@ -1,6 +1,6 @@
     services:
       flysystem_s3.file_system:
         public: false
    -    class: \Drupal\flysystem_s3\File\FlysystemS3FileSystem
    +    class: Drupal\flysystem_s3\File\FlysystemS3FileSystem
         decorates: file_system
         arguments: ['@stream_wrapper_manager', '@settings', '@logger.channel.file']
    diff --git a/tests/src/Functional/ModuleInstallUninstallWebTest.php b/tests/src/Functional/ModuleInstallUninstallWebTest.php
    index b33704d..755b9a4 100644
    --- a/tests/src/Functional/ModuleInstallUninstallWebTest.php
    +++ b/tests/src/Functional/ModuleInstallUninstallWebTest.php
    @@ -14,6 +14,6 @@ class ModuleInstallUninstallWebTest extends Base {
       /**
        * {@inheritdoc}
        */
    -  public static $modules = ['flysystem_s3'];
    +  protected static $modules = ['flysystem_s3'];
     
     }
    diff --git a/tests/src/Unit/Flysystem/S3Test.php b/tests/src/Unit/Flysystem/S3Test.php
    index c574a71..b772102 100644
    --- a/tests/src/Unit/Flysystem/S3Test.php
    +++ b/tests/src/Unit/Flysystem/S3Test.php
    @@ -13,6 +13,7 @@ use Drupal\flysystem_s3\Flysystem\S3;
     use League\Flysystem\AdapterInterface;
     use League\Flysystem\Config;
     use Prophecy\Argument;
    +use Prophecy\PhpUnit\ProphecyTrait;
     use Symfony\Component\HttpFoundation\Request;
     use Symfony\Component\HttpFoundation\RequestStack;
     
    @@ -23,6 +24,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
      */
     class S3Test extends UnitTestCase {
     
    +  use ProphecyTrait;
       /**
        * @covers ::__construct
        * @covers ::getExternalUrl
    
  • 🇬🇧United Kingdom Eli-T Manchester

    Hi @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

  • 🇫🇮Finland sceefo

    @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.

  • 🇬🇧United Kingdom Eli-T Manchester

    I'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

  • 🇬🇧United Kingdom polynya

    I've tested the patch successfully on 9.5 but haven't tried 10 yet

  • 🇬🇧United Kingdom Eli-T Manchester

    Thanks @polynya! Good to know.

  • 🇨🇦Canada adam-vessey PE, Canada

    I've tested this out against D10, and it seems to work.

    Procedure employed:

    1. Up'd base D10 ddev env using instructions: https://ddev.readthedocs.io/en/latest/users/quickstart/#drupal
    2. Change minimum-stability to dev
      • prefer-stable is left as true
    3. Added adjusted repo entries more or less according to #3297257-28: Automated Drupal 10 compatibility fixes , but with canonical to false on each entry
    4. ddev composer require "drupal/flysystem_s3:dev-3297257-automated-drupal-10 as 2.x-dev"
    5. configured $settings['flysystem'] in web/sites/default/settings.php (with the test-thing scheme)
      • made use of a key/secret ("borrowed" from an existing env)
      •     $settings['flysystem'] = [
              'test-thing' => [
                'driver' => 's3',
                'config' => [
                  [... snipped key, secret, region, bucket, public and prefix values ...]
                ],
                'cache' => TRUE,
              ],
            ];
            
    6. ddev drush en flysystem_s3
    7. ddev drush cr ('cause paranoia)
    8. ddev drush php-eval "var_dump(file_put_contents('test-thing://some-dir/file.txt', 'what'));"
      Output: int(4)
    9. 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.

  • 🇬🇧United Kingdom Eli-T Manchester

    Thanks @adam-vessey 💙

    I think we have enough to proceed with a release now.

  • Status changed to RTBC about 1 year ago
  • 🇬🇧United Kingdom Eli-T Manchester

    Setting to RTBC and adding credit

  • Status changed to Fixed about 1 year ago
  • 🇬🇧United Kingdom Eli-T Manchester
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024