Problem/Motivation

It should be possible to purge out activity entries (either automatically or manually) as it can grow to a potentially unmanageable number if the site has lots of operations.

Proposed resolution

1. Provide a UI configuration that specifies how to purge entries: Never, Time-based or Count-based
2. Add cron job/queue that deletes jobs based on those settings.
3. Have a manual page that can trigger a batch job which purges specific entity type activities.

Remaining tasks

Provide issue fork.

User interface changes

New configuration form and routes for purging the activities.

Comments

codebymikey created an issue. See original summary.

codebymikey’s picture

This feature is available in the recently_read and message modules.

ahmad-alyasaki’s picture

a comprehensive purge mechanism for activity entries to prevent database growth.

### Features
- **Automatic purging** via cron (Time-based or Count-based)
- **Manual purge interface** with batch operations
- **Entity-type filtering** with optional bundle selection
- **Permission-based access control**
- **Real-time statistics** displaying record counts

### New Service
- `activities.purge` - Provides purging functionality

### New Permissions
- `purge activities` - Allows manual purging of activity entries

### New Routes
- `activities.purge_config_form` - `/admin/config/activities/purge`
- `activities.manual_purge_form` - `/admin/config/activities/purge/manual`

### New Hook Implementation
- `activities_cron()` - Executes automatic purging based on configuration

## Usage

### Automatic Purging
1. Navigate to `/admin/config/activities/purge`
2. Select purge method:
- **Never** - Keep all entries
- **Time-based** - Delete entries older than specified time
- **Count-based** - Keep only the most recent N entries
3. Save configuration
4. Purge runs automatically during cron

### Manual Purging
1. Navigate to `/admin/config/activities/purge/manual`
2. Choose purge type:
- Delete all activities
- Delete by entity type (with optional bundle filter)
- Delete entries older than specified time
3. Click "Purge Activities"
4. Batch operation processes the deletion

ahmad-alyasaki’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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