Problem/Motivation
Orphaned block content entities currently require manual cleanup operations.
Without automated cleanup support, orphaned blocks may continue accumulating over time, increasing unnecessary content clutter and maintenance overhead.
The module should integrate with Drupal cron so orphan cleanup can run automatically at configurable intervals.
Steps to reproduce
- Create orphaned custom block content entities
- Wait for normal Drupal cron execution
- Observe that orphaned blocks are not automatically processed or cleaned
Proposed resolution
- Implement
hook_cron()inblock_content_explorer.module - Load orphan cleanup configuration from
block_content_explorer.settings - Check whether automatic cleanup is enabled
- Track the last cleanup execution timestamp using Drupal State API
- Run orphan cleanup only when the configured interval has passed
- Call the
block_content_explorer.orphan_cleanerservice during cron execution - Update the last-run timestamp after successful cleanup
Remaining tasks
- Implement
hook_cron() - Add configuration checks for automatic cleanup
- Add State API integration for last-run tracking
- Integrate orphan cleaner service
- Test cron execution using
drush cron - Verify cleanup activity through Recent log messages
User interface changes
None.
API changes
Adds cron integration through:
hook_cron()
Data model changes
None.
This implementation uses the Drupal State API for runtime tracking and does not introduce database schema changes.
Issue fork block_content_explorer-3589438
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
oshi02 commentedComment #5
mohnish s. yadavModification done at -
" block_content_explorer.settings "
"block_content_explorer.module "