Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

entity_purge

No security coverage
View on drupal.org

The Entity Purge modules provides a system for purging Drupal entities. For example, daily delete all entities of type X that are older than 1 month.

Features

  • It provides a purge plugin that allows you to delete during cron entities based on their age.
  • For Commerce users, it provides a purge plugin that allows you to delete Commerce carts during cron based on their creation time.
  • Custom plugins can be written that can collect the entities to be deleted based on custom criteria.
  • Automated unit tests, so that you can sleep at night.

Usage

Currently, there is no UI. Configuration entities must be created by a developer and imported via Drush or the config UI.

As an example, to delete all nodes older than 45 days, create a file at "config/sync/entity_purge.type.my_app_old_nodes.yml" with the following content. You may change the ID of the purge type from "my_app_old_nodes" to whatever suits your case.

langcode: en
# Purges for types disabled here will not be executed. 
status: true
dependencies:
  module:
    - node
id: my_app_old_nodes
label: 'Old content items'
description: 'Purges content items older than 45 days, 200 at a time.'
plugin_id: age
plugin_config:
  # Enable debugging for testing. No entities will be deleted.
  # Use with logging enabled.
  # debug: true
  # Enable logging to monitor which entities are being deleted.
  # log: true
  # Purges will be automatically run via cron. Set to `custom`
  # if you want to call the purger yourself in your code. 
  scheduler: cron
  entity_type_id: node
  # Change to `changed` to delete nodes based on their last
  # updated time. 
  field_name: created
  # Minimum age in seconds; nodes older than this will be
  # deleted.
  min_age: 3888000
  # Do not increase this limit too much. Rather, if you have
  # too many items regularly generated - such as logs,
  # set the cron to run more frequently using a module like
  # Ultimate Cron.
  limit: 200

Import the configuration, then export it so that you get the uuid property assigned by the system.

Additional Requirements

This module only requires Drupal core versions 9+, and PHP 8+.

Supporting this Module

Create issues in the Drupal.org queue, submit MRs. If you are interested in sponsoring this module to add more features, contact the module maintainers.

Activity

Total releases
2
First release
Jun 2025
Latest release
9 months ago
Release cadence
0 days
Stability
0% stable

Releases

Version Type Release date
1.0.0-beta4 Pre-release Jun 24, 2025
1.0.0-beta3 Pre-release Jun 24, 2025