How to gracefully composer remove drupal/node_revision_generate

Created on 19 April 2024, 7 months ago
Updated 1 July 2024, 5 months ago

Problem/Motivation

My website has node_revision_delete and node_revision_generate installed. Recently, "plugin does not exist" errors appear.

The problem has been found to be the inability to update node_revision_generate which appears to have been removed from www.drupal.org.

Steps to reproduce

If I "composer remove node_revision_generate" and "composer remove node_revision_delete", the "plugin does not exist" errors appear.

If I "composer require node_revision_delete", the "plugin does not exist" errors disappear.

If I "composer require node_revision_generate", it appears to have been successful but is actually not installed.

The status report says "is marked as installed in the core.extension configuration, but it is missing".

I understand that drupal/node_revision_generate was a test module and might have been removed from drupal.

How can I remove it from core.extension? I have used "drush cedit" without success.

Alternatively, can I have the drupal/node_revision_generate back so that I can properly "composer remove" it?

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

🇭🇰Hong Kong kc tang

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

Comments & Activities

  • Issue created by @kc tang
  • 🇨🇦Canada adriancid Montreal, Canada

    The node revision generate module is just for test pourpose, so this module don;t made nothing in your site other than generate revisions to test the node revision generate module, it was removed on the latest version.

    You can do the following

    - composer require 'drupal/node_revision_delete:^1.0@RC'
    - uninstall the module
    - export the configs
    - composer require 'drupal/node_revision_delete:^2.0@RC'

  • 🇨🇦Canada adriancid Montreal, Canada
  • 🇭🇰Hong Kong kc tang

    I do not know exactly how to do with "export the configs".
    I have accessed Admin > Configuration > Configuration synchronization > Export > Single item, and found
    Configuration type: simple configuration
    Configuration name: node_revision_delete.settings
    Configuration: disable_automatic_queueing: false
    Filename: node_revision_delete.settings.yml

    I have done:
    composer require 'drupal/node_revision_delete:^1.0@RC'
    [no error]
    composer remove 'drupal/node_revision_generate'
    [no error]
    composer require 'drupal/node_revision_delete:^2.0@RC'
    [node_revision_generate reported as missing at Status report]
    composer remove 'drupal/node_revision_generate'
    [no change, same error]
    composer remove 'drupal/node_revision_delete"
    [node_revision_delete and node_revision_generate reported as missing at Status report]
    composer require 'drupal/node_revision_delete:^1.0@RC'
    [no error]

    So, it means that I have to stay with 'drupal/node_revision_delete:^1.0@RC'.

  • 🇨🇦Canada adriancid Montreal, Canada

    - composer require 'drupal/node_revision_delete:^1.0@RC'
    - drush pmu -y node_revision_generate
    - drush cex
    - composer require 'drupal/node_revision_delete:^2.0@RC'

  • 🇭🇰Hong Kong kc tang

    Done successfully. Thank you!

    I had to use "sudo drush cex". Any need to keep the exported .../sync folder?

  • 🇭🇰Hong Kong kc tang

    After the above, I edited a page (no 'Create new revision has been checked'). Upon saving, the following error appeared. The saving was not successful.:

    The website encountered an unexpected error. Try again later.
    
    TypeError: Drupal\node_revision_delete\NodeRevisionDelete::__construct(): Argument #1 ($entity_type_manager) must be of type Drupal\Core\Entity\EntityTypeManagerInterface, Drupal\Core\Config\ConfigFactory given, called in /var/www/html/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\node_revision_delete\NodeRevisionDelete->__construct() (line 61 of modules/contrib/node_revision_delete/src/NodeRevisionDelete.php).
    

    I executed composer remove 'drupal/node_revision_delete'. The following error was reported by the Status report:

    The website encountered an unexpected error. Try again later.
    
    Drupal\Core\Extension\Exception\UnknownExtensionException: The module node_revision_delete does not exist or is not installed. in Drupal\Core\Extension\ExtensionList->getExtensionInfo() (line 348 of core/lib/Drupal/Core/Extension/ExtensionList.php).The website encountered an unexpected error. Try again later.
    Drupal\Component\Plugin\Exception\PluginException: Plugin (node_revision_delete) instance class "Drupal\node_revision_delete\Plugin\QueueWorker\NodeRevisionDelete" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

    I executed composer require 'drupal/node_revision_delete'. No error was reported. But when I edited the page again, the same error appeared again.

    I selected Admin > Extend > Note Revision Delete > Configure (I had not configured it after the re-installation pursuant to the above), the following error message appeared:

    The website encountered an unexpected error. Try again later.
    
    Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "plugin.manager.node_revision_delete". in Drupal\Component\DependencyInjection\Container->get() (line 157 of core/lib/Drupal/Component/DependencyInjection/Container.php).The website encountered an unexpected error. Try again later.
    

    I executed composer require 'drupal/node_revision_delete:^1.0@RC', no error message appeared. node_revision_generate was also back, but I did not select it.

    I edited the page again and saved it. No error.

    I again selected Admin > Extend > Note Revision Delete > Configure, the following error message appeared:

    The website encountered an unexpected error. Try again later.
    
    TypeError: Drupal\node_revision_delete\NodeRevisionDelete::getRelativeTime(): Argument #2 ($number) must be of type int, null given, called in /var/www/html/web/modules/contrib/node_revision_delete/src/NodeRevisionDelete.php on line 429 in Drupal\node_revision_delete\NodeRevisionDelete->getRelativeTime() (line 454 of modules/contrib/node_revision_delete/src/NodeRevisionDelete.php).The website encountered an unexpected error. Try again later.
    Drupal\Component\Plugin\Exception\PluginException: Plugin (node_revision_delete) instance class "Drupal\node_revision_delete\Plugin\QueueWorker\NodeRevisionDelete" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).
    

    I went back to the edited and saved page, the following error message appeared:

    Warning: Undefined array key "minimum_revisions_to_keep" in Drupal\node_revision_delete\Form\AdminSettingsForm->buildForm() (line 154 of modules/contrib/node_revision_delete/src/Form/AdminSettingsForm.php).
    Warning: Undefined array key "minimum_age_to_delete" in Drupal\node_revision_delete\Form\AdminSettingsForm->buildForm() (line 157 of modules/contrib/node_revision_delete/src/Form/AdminSettingsForm.php).
    Warning: Undefined array key "when_to_delete" in Drupal\node_revision_delete\Form\AdminSettingsForm->buildForm() (line 161 of modules/contrib/node_revision_delete/src/Form/AdminSettingsForm.php).
    Warning: Undefined array key "minimum_age_to_delete" in Drupal\node_revision_delete\NodeRevisionDelete->getContentTypeConfigWithRelativeTime() (line 429 of modules/contrib/node_revision_delete/src/NodeRevisionDelete.php).
    

    I left the site on the browser and came back to the page, the above error message did not appear (but appeared later elsewhere as stated below).

    I again selected Admin > Extend > Note Revision Delete > Configure, the following slightly different error message appeared:

    The website encountered an unexpected error. Try again later.
    
    TypeError: Drupal\node_revision_delete\NodeRevisionDelete::getRelativeTime(): Argument #2 ($number) must be of type int, null given, called in /var/www/html/web/modules/contrib/node_revision_delete/src/NodeRevisionDelete.php on line 429 in Drupal\node_revision_delete\NodeRevisionDelete->getRelativeTime() (line 454 of modules/contrib/node_revision_delete/src/NodeRevisionDelete.php).
    

    I assessed Admin > Configuration, the following error message re-appeared:

    Warning: Undefined array key "minimum_revisions_to_keep" in Drupal\node_revision_delete\Form\AdminSettingsForm->buildForm() (line 154 of modules/contrib/node_revision_delete/src/Form/AdminSettingsForm.php).
    Warning: Undefined array key "minimum_age_to_delete" in Drupal\node_revision_delete\Form\AdminSettingsForm->buildForm() (line 157 of modules/contrib/node_revision_delete/src/Form/AdminSettingsForm.php).
    Warning: Undefined array key "when_to_delete" in Drupal\node_revision_delete\Form\AdminSettingsForm->buildForm() (line 161 of modules/contrib/node_revision_delete/src/Form/AdminSettingsForm.php).
    Warning: Undefined array key "minimum_age_to_delete" in Drupal\node_revision_delete\NodeRevisionDelete->getContentTypeConfigWithRelativeTime() (line 429 of modules/contrib/node_revision_delete/src/NodeRevisionDelete.php).
    

    There should be some problem with updating to ^2.0@RC. Downgrading to ^1.0@RC cannot eliminate it.

  • 🇭🇰Hong Kong kc tang

    The last error message also appeared again when I browsed to the edited page.

    I executed the following:
    drush pmu -y node_revision_delete
    drush cex

    The error message did not appear again at the Configuration page or the edited page.

    Node_revision_delete and node_revision_generate still appeared under Admin > Extend, but unchecked.

    I executed composer remove drupal/node_revision_delete.

    No more error, but also no more node_revision_delete.

  • 🇨🇦Canada adriancid Montreal, Canada

    After this command:

    - composer require 'drupal/node_revision_delete:^2.0@RC'

    You need to clear the cache:

    - drush cr

  • 🇭🇰Hong Kong kc tang

    Done. No problem. Thanks!

  • Status changed to Closed: works as designed 5 months ago
  • 🇦🇹Austria tgoeg

    I guess this can be closed, then.

Production build 0.71.5 2024