This Module is not compatible with Drupal 9.

Command icon 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

Gauravmahlawat created an issue. See original summary.

gauravvvv’s picture

Status: Active » Needs review
StatusFileSize
new571 bytes

Here, I am providing a patch please verify if it is working or not.

tjtj’s picture

Doesa not work on 9.1.x

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "mass_contact_confirm_info" has a dependency on a non-existent service "user.private_tempstore". in Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue() (line 86 of /home/briarcli/public_html/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php).

gauravvvv’s picture

The only solution I found for this is explained in this blog post - https://www.computerminds.co.uk/articles/apply-drupal-9-compatibility-pa... - which basically boils down to:
- telling composer to use the source git repo for the package instead of using the official Drupal 'packages' repo

"repositories": [
  {
    "type": "package",
    "package": {
      "name": "drupal_git/belgrade",
      "type": "drupal-module",
      "version": "dev-8.x-1.x",
      "source": {
        "type": "git",
        "url": "https://git.drupalcode.org/project/belgrade.git",
        "reference": "efdc324ae8c48fca9e6fce81781eece0cee0c313"
      }
    }
  },
  {
    "type": "composer",
    "url": "https://packages.drupal.org/8"
  }
],

- (making sure you require the cweagans/composer-patches package)

- applying the patch in the normal way in composer.json inside "extra"

"patches": {
  "drupal/belgrade": {
    "Drupal 9.0 support": "https://www.drupal.org/files/issues/2020-11-15/d9-ready-3151610-3.patch"
  }
},

- then requiring the project - I did this yesterday after trying several things so I can't remember exactly whether it worked with composer require or composer update

Unfortunately I tried so many things before I got it working that I'm not yet entirely sure whether it worked due to the fact I added the bit mentioned in one of the comments in the blog post above, which is basically faking drupal 9 to be 'seen' as drupal 8:
"drupal/core": "9.1.4 as 8.9.99",
So if you would still have an issue after the points above then can always try this.

But anyway, back to the point, the patch works great and the theme installs and works great after this one line patch so I'd say the quicker it gets committed the less people would have to struggle requiring it on a new D9 site.

mvogel’s picture

StatusFileSize
new1.07 KB

Needed to remove the information added by the Drupal.org packaging script to apply the patch correctly.

mvogel’s picture

StatusFileSize
new13.61 KB

I ran drush upgrade_status and fixed the points below + the info yml problem

drush us-a mass_contact
[notice] Processing /var/www/web/modules/contrib/mass_contact.

================================================================================
Mass Contact, 8.x-1.0-beta2
Scanned on Mo., 19.04.2021 - 08:08

FILE: web/modules/contrib/mass_contact/src/Form/MassContactForm.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 69 Parameter $entity_manager of method
Drupal\mass_contact\Form\MassContactForm::__construct() has
typehint with deprecated interface
Drupal\Core\Entity\EntityManagerInterface. Deprecated in
drupal:8.0.0 and is removed from drupal:9.0.0.
--------------------------------------------------------------------------------
Fix now 69 Parameter $temp_store_factory of method
Drupal\mass_contact\Form\MassContactForm::__construct() has
typehint with deprecated class
Drupal\user\PrivateTempStoreFactory. Deprecated in
drupal:8.5.0 and is removed from drupal:9.0.0. Use
Drupal\Core\TempStore\PrivateTempStoreFactory instead.
--------------------------------------------------------------------------------

FILE:
web/modules/contrib/mass_contact/src/Form/MassContactMessageConfirmForm.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 74 Parameter $temp_store_factory of method
Drupal\mass_contact\Form\MassContactMessageConfirmForm::__co
nstruct() has typehint with deprecated class
Drupal\user\PrivateTempStoreFactory. Deprecated in
drupal:8.5.0 and is removed from drupal:9.0.0. Use
Drupal\Core\TempStore\PrivateTempStoreFactory instead.
--------------------------------------------------------------------------------

FILE: web/modules/contrib/mass_contact/src/MessageListBuilder.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 45 Call to deprecated method getStorage() of class
Drupal\Core\Entity\EntityManager. Deprecated in drupal:8.0.0
and is removed from drupal:9.0.0. Use
Drupal\Core\Entity\EntityTypeManagerInterface::getStorage()
instead.
--------------------------------------------------------------------------------

FILE:
web/modules/contrib/mass_contact/src/ParamConverter/MassContactConfirmConverter.
php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 27 Parameter $temp_store_factory of method
Drupal\mass_contact\ParamConverter\MassContactConfirmConvert
er::__construct() has typehint with deprecated class
Drupal\user\PrivateTempStoreFactory. Deprecated in
drupal:8.5.0 and is removed from drupal:9.0.0. Use
Drupal\Core\TempStore\PrivateTempStoreFactory instead.
--------------------------------------------------------------------------------

FILE:
web/modules/contrib/mass_contact/src/Plugin/MassContact/GroupingMethod/GroupingI
nterface.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Check manually 13 Interface
Drupal\mass_contact\Plugin\MassContact\GroupingMethod\Groupi
ngInterface extends deprecated interface
Drupal\Component\Plugin\ConfigurablePluginInterface:
Drupal\Component\Plugin\ConfigurablePluginInterface is
deprecated in Drupal 8.7.0 and will be removed before Drupal
9.0.0. You should implement ConfigurableInterface and/or
DependentPluginInterface directly as needed. If you
implement ConfigurableInterface you may choose to implement
ConfigurablePluginInterface in Drupal 8 as well for maximum
compatibility, however this must be removed prior to Drupal
9.
--------------------------------------------------------------------------------

FILE: web/modules/contrib/mass_contact/src/Tests/Form/AdminSettingsFormTest.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 14 Class Drupal\mass_contact\Tests\Form\AdminSettingsFormTest
extends deprecated class
Drupal\system\Tests\System\SystemConfigFormTestBase.
Deprecated in drupal:8.6.0 and is removed from drupal:9.0.0.
Use \Drupal\KernelTests\ConfigFormTestBase instead.
--------------------------------------------------------------------------------
Fix now 27 Call to method setUp() of deprecated class
Drupal\simpletest\WebTestBase. Deprecated in drupal:8.6.0
and is removed from drupal:9.0.0. Use
\Drupal\KernelTests\ConfigFormTestBase instead.
--------------------------------------------------------------------------------

FILE: web/modules/contrib/mass_contact/src/Tests/Form/EmailBodyFormTest.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 13 Class Drupal\mass_contact\Tests\Form\EmailBodyFormTest
extends deprecated class
Drupal\system\Tests\System\SystemConfigFormTestBase.
Deprecated in drupal:8.6.0 and is removed from drupal:9.0.0.
Use \Drupal\KernelTests\ConfigFormTestBase instead.
--------------------------------------------------------------------------------
Fix now 26 Call to method setUp() of deprecated class
Drupal\simpletest\WebTestBase. Deprecated in drupal:8.6.0
and is removed from drupal:9.0.0. Use
\Drupal\KernelTests\ConfigFormTestBase instead.
--------------------------------------------------------------------------------

FILE: web/modules/contrib/mass_contact/src/Tests/Form/EmailHeaderFormTest.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 14 Class Drupal\mass_contact\Tests\Form\EmailHeaderFormTest
extends deprecated class
Drupal\system\Tests\System\SystemConfigFormTestBase.
Deprecated in drupal:8.6.0 and is removed from drupal:9.0.0.
Use \Drupal\KernelTests\ConfigFormTestBase instead.
--------------------------------------------------------------------------------
Fix now 27 Call to method setUp() of deprecated class
Drupal\simpletest\WebTestBase. Deprecated in drupal:8.6.0
and is removed from drupal:9.0.0. Use
\Drupal\KernelTests\ConfigFormTestBase instead.
--------------------------------------------------------------------------------

FILE:
web/modules/contrib/mass_contact/tests/src/Kernel/CategoryAccessControlHandlerTe
st.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 16 Usage of deprecated trait
Drupal\simpletest\UserCreationTrait in class
Drupal\Tests\mass_contact\Kernel\CategoryAccessControlHandle
rTest. Deprecated in drupal:8.4.0 and is removed from
drupal:9.0.0. Use
Drupal\Tests\user\Traits\UserCreationTrait instead.
--------------------------------------------------------------------------------

FILE:
web/modules/contrib/mass_contact/tests/src/Kernel/Entity/MassContactCategoryTest
.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 20 Usage of deprecated trait
Drupal\simpletest\UserCreationTrait in class
Drupal\Tests\mass_contact\Kernel\Entity\MassContactCategoryT
est. Deprecated in drupal:8.4.0 and is removed from
drupal:9.0.0. Use
Drupal\Tests\user\Traits\UserCreationTrait instead.
--------------------------------------------------------------------------------

FILE: web/modules/contrib/mass_contact/tests/src/Kernel/MassContactTest.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 18 Usage of deprecated trait
Drupal\simpletest\UserCreationTrait in class
Drupal\Tests\mass_contact\Kernel\MassContactTest. Deprecated
in drupal:8.4.0 and is removed from drupal:9.0.0. Use
Drupal\Tests\user\Traits\UserCreationTrait instead.
--------------------------------------------------------------------------------

FILE: web/modules/contrib/mass_contact/tests/src/Kernel/OptOutTest.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 18 Usage of deprecated trait
Drupal\simpletest\UserCreationTrait in class
Drupal\Tests\mass_contact\Kernel\OptOutTest. Deprecated in
drupal:8.4.0 and is removed from drupal:9.0.0. Use
Drupal\Tests\user\Traits\UserCreationTrait instead.
--------------------------------------------------------------------------------

FILE:
web/modules/contrib/mass_contact/tests/src/Kernel/Plugin/MassContact/GroupingMet
hod/RoleTest.php

STATUS LINE MESSAGE
--------------------------------------------------------------------------------
Fix now 19 Usage of deprecated trait
Drupal\simpletest\UserCreationTrait in class
Drupal\Tests\mass_contact\Kernel\Plugin\MassContact\Grouping
Method\RoleTest. Deprecated in drupal:8.4.0 and is removed
from drupal:9.0.0. Use
Drupal\Tests\user\Traits\UserCreationTrait instead.
--------------------------------------------------------------------------------

mvogel’s picture

StatusFileSize
new14.66 KB

One point missing, updated patch

mlncn’s picture

StatusFileSize
new13.9 KB

This patch is mvogel's unchanged *except* it should apply now because i removed the extra a/mass_contact/ etc. in front of every chunk— the patch works from the perspective of the module itself, not the contrib directory or such.

mlncn’s picture

StatusFileSize
new14.03 KB

Patch that fully applies on fresh git checkout.

Status: Needs review » Needs work

The last submitted patch, 9: D9-ready-3182772-7.patch, failed testing. View results

mlncn’s picture

The test that's failing looks to be an empty shell. Near as i can tell it's something of a false failure (in the module itself, the message_prefix and message_suffix look to always be correctly initialized as a text_format— format and value), but i can't identify why it's failing now or how to fix it easily.

bsztreha’s picture

Status: Needs work » Needs review
StatusFileSize
new14.45 KB

Found the fix for test failure Drupal\Tests\mass_contact\Functional\Form\MassContactFormTest
Need to replace old private storage:
$store = \Drupal::service("user.private_tempstore")->get('mass_contact_confirm_info');
to new
$store = \Drupal::service("tempstore.private")->get('mass_contact_confirm_info');
in submitForm()

Edit: The other failures come from these modifications:

-class EmailBodyFormTest extends SystemConfigFormTestBase {
+class EmailBodyFormTest extends ConfigFormTestBase {

So need to finish mass_contact/src/Tests/Form/EmailBodyFormTest.php $values part, but I am not aware of this kind of test

Status: Needs review » Needs work

The last submitted patch, 12: D9-ready-3182772-12.patch, failed testing. View results

mlncn’s picture

Ah good! I hadn't looked as far as that test! Was stuck on EmailBodyFormTest which i still suspect isn't "our fault".

I think because Drupal core module dependencies are listed in the .info.yml file, Drupal.org generates a composer.json with a requirement specifically for Drupal 8 (since that is what is defined in the .info.yml). To use a D9-compatible version of Mass Contact in a composer-managed project then i'll create an issue fork based on bsztreha's latest patch — that is here: git@git.drupal.org:issue/mass_contact-3182772.git

Can be used per https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupa... for using Mass Contact with a D9 site.

jhedstrom made their first commit to this issue’s fork.

jhedstrom’s picture

Status: Needs work » Needs review

Thanks all! I've merged the above patch into a branch and fixed the failing tests and deprecations. I'll merge the MR once tests pass.

jhedstrom’s picture

Status: Needs review » Fixed

Thanks all! I've tagged a new release to include this fix.

jhedstrom’s picture

Category: Support request » Task

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.