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

  1. Create orphaned custom block content entities
  2. Wait for normal Drupal cron execution
  3. Observe that orphaned blocks are not automatically processed or cleaned

Proposed resolution

  • Implement hook_cron() in block_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_cleaner service 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.

Command icon 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

mohnish s. yadav created an issue. See original summary.

oshi02 made their first commit to this issue’s fork.

oshi02’s picture

Status: Active » Needs review
mohnish s. yadav’s picture

Status: Needs review » Fixed

Modification done at -
" block_content_explorer.settings "
"block_content_explorer.module "

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.