Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Entity Purge

No security coverage Under active development 8 sites

Part of the Entity ecosystem · 308 projects

This module provides a way to automatically delete old content from your Drupal site based on criteria you define, like deleting nodes older than a certain date. It can also be used to purge other entity types or specific items like abandoned shopping carts.

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.

Ask your assistant about Entity Purge

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
6
Tracked since
Aug 2024
Latest release
1 month ago
Releases (12 mo)
1 ▼ from 2
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
1.0.0-beta5 Pre-release 9–11 Aug 24, 2026
1.0.0-beta4 Pre-release 9–10 Jun 24, 2025
1.0.0-beta3 Pre-release 9–10 Jun 24, 2025
1.0.0-beta2 Pre-release 9–10 PHP ^8.0 Sep 9, 2024
1.0.0-beta1 Pre-release 9–10 PHP ^8.0 Aug 8, 2024
1.x-dev Dev 9–11 PHP ^8.0 Aug 8, 2024