Problem/Motivation
When I try to install the HTMLMail module via composer on Drupal 9.0.2 installation obtain an error of compatibility and none installation has made.
Steps to reproduce
Create a new project via composer for Drupal 9
$ composer create-project drupal/recommended-project my_site_name_dir
$ composer require drupal/htmlmail
Proposed resolution
I made the requested update to the sources to make the module compliant with Drupal 9.x in the patch attached to this issue
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3163507-6-file-scan-directory.patch | 906 bytes | tr |
Comments
Comment #2
salvisThank you for the report and patch, umpire274!
Comment #3
salvisThe patch contains tabs and other non-standard white space and indenting.
Also, it doesn't follow the advice given in https://api.drupal.org/api/drupal/core%21includes%21file.inc/function/fi...
Comment #4
tr commentedThere are a lot more things that need to be fixed to make this module compatible with D9.
For example, the Simpletest needs to be ported to PHPUnit, as Simpletest is no longer supported in D9. See #2990651: Move tests from Simpletest/WebTestBase to PHPUnit/BrowserTestBase
If this is to be done, it would be best IMO to make a meta issue and address each problem individually BEFORE changing the core_version_requirement. It is best to keep the core dependency completely accurate so that people don't try to install this on D9.
Comment #5
tr commented@salvis: I don't know exactly what you meant in #3 when you said "it doesn't follow the advice given in..."
Aside from the patch format and the coding standards, what there something you thought was wrong about using scanDirectory() here?
Comment #6
tr commentedHere's a re-roll of #1 with only the file_scan_directory() change.
Comment #7
salvisThe documentation says to
Comment #8
tr commentedUnfortunately most deprecation messages are pretty vague and lacking specifics about exactly how to replace the deprecated code. These messages contain a lot of assumptions.
In this case, we can't call
FileSystemInterface::scanDirectory()directly -FileSystemInterfaceis an interface. So we need find and use an object that implementsFileSystemInterfacein order to callscanDirectory(). Specifically, we have to get thefile_systemservice class returned from\Drupal::service('file_system'), which is the object we need.So I think the patch in #6 is the right way to do this. We have to use
\Drupal::service()instead of injecting the service because we're doing this in procedural code in the htmlmail.module file.Comment #9
tr commentedCommitted #6 with the wrong commit message, which is why the commit doesn't show up here in this issue. That can't be fixed, as the commit is already pushed.
The commit is: 636563534897c1759