How to bulk delete all revisions besides current revision for all nodes from all content types?

Created on 19 February 2024, 9 months ago
Updated 16 July 2024, 4 months ago

I want to bulk delete all revisions besides current revision for all nodes from all content types.

On Drupal 10.2.2 I have installed the module this way:

cd WEBSITE_DIR
composer require 'drupal/node_revision_delete:^2.0@alpha'
drush en node_revision_delete

I then tried to run this command:

vendor/bin/drush nrd-delete-prior-revisions

I got:

Command "nrd-delete-prior-revisions" is not defined.

How to bulk delete all revisions besides current revision for all nodes from all content types?

💬 Support request
Status

Fixed

Version

2.0

Component

Miscellaneous

Created by

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

Comments & Activities

  • Issue created by @bendqh1
  • 🇨🇦Canada adriancid Montreal, Canada

    The command exists but only works for one node, there is nothing to do this task. You need to go and configure all the content types for this. Or you can check the code for the command and implement something for all your nodes.

  • Hello Adriancid !

    Please help me out here a bit more as I am not a PHP programmer and probably don't fully get what do you suggest me to try.

    I have more than 600 nodes so I need some automation.
    For example, I have a content type named dp_ltr, so I have tried this:

    vendor/bin/drush node-revision-delete dp_ltr
    

    But I got:

    Command "node-revision-delete" is not defined.

  • 🇨🇦Canada adriancid Montreal, Canada

    You're trying to execute a drush command from version 8.x-1.x in version 2.x if you see the project page all the listed command there are under the version 1 section

    The only commands in version 2.x are:

    - nrd-delete-prior-revisions (that is working because I just test the command) and is to delete all the revisions previous to a specific revision.
    - node-revision-delete:queue This one check all the content types configuracions and add the items to the queue, once they are in the queue they are deleted each time cron runs.

    There is nothing at this time to allow what you need with a command.

  • Thanks Adriancid.

    Do you have any suggestion for me what to do if all I want is just no revisions besides current revision for all nodes from all content types?

  • Should I run this command?

    vendor/bin/drush nrd-delete-prior-revisions CONTENT_TYPE_NAME

  • 🇨🇦Canada adriancid Montreal, Canada

    As I said before you need to go and configure each content type

  • 🇨🇦Canada adriancid Montreal, Canada
  • Status changed to Fixed 9 months ago
  • 🇨🇦Canada adriancid Montreal, Canada
  • I did this and ran cron but old revisions still exist.

  • 🇨🇦Canada adriancid Montreal, Canada

    After configure each content type you need to add them to the queue with

    drush node-revision-delete:queue

    And after each time cron runs it will process an amount of elements from the queue.

    I released a new version of the module today, so will be better if you update the module before add the elements to the queue.

  • 🇨🇦Canada adriancid Montreal, Canada

    You can use the following module to check the queue:

    * Queue UI ( https://www.drupal.org/project/queue_ui ):
    A user interfaces for viewing and managing Drupal queues created via the
    Queue API.

  • Thanks a lot adriancid.

    I think that I will keep old revisions existing for now and just wait until there is a CLUI command or a GUI button to just delete all revisions which are not the current revision, anywhere and everywhere.

  • Status changed to Postponed 9 months ago
  • Status changed to Fixed 9 months ago
  • 🇨🇦Canada adriancid Montreal, Canada

    @bendqh1 This is not a feature request, the functionality exists and I explained how it works.

  • Adriancid I misunderstood the explanation.

    Do you mean that after I click the button and put the number 1 💬 How to bulk delete all revisions besides current revision for all nodes from all content types? Fixed , then I should run commands as follows?

    drush node-revision-delete:queue CONTENT_TYPE_1
    drush node-revision-delete:queue CONTENT_TYPE_2
    drush node-revision-delete:queue CONTENT_TYPE_3
    drush node-revision-delete:queue CONTENT_TYPE_4
    drush node-revision-delete:queue CONTENT_TYPE_5
    
  • 🇨🇦Canada adriancid Montreal, Canada

    You just need to execute:

    drush node-revision-delete:queue

  • Thanks a lot for all your guidance and help dear Adriancid.

    May this be an inspiration to others !

    :)

  • 🇨🇦Canada adriancid Montreal, Canada

    It was a pleasure to help you

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

  • Sorry to open this dormant post but I think that the action I did here caused all relevant nodes to appear as if they have certain taxonomy terms but the taxonomy term pages of these term to "ignore" these nodes:

    Dear adriancid and other maintainers of this module, please check this thread and opine if you have any opinion to give about it:
    Some taxonomy term pages don't include old nodes but they will include new nodes 💬 Some taxonomy term pages don't include old nodes but they will include new nodes Active .

    Thanks.

Production build 0.71.5 2024