Problem/Motivation

The orphan cleanup service currently removes orphaned block content entities directly without providing a preview mode or operational logging.

A dry-run mode is needed so administrators and developers can verify which entities would be deleted before performing destructive cleanup operations. Logging support is also needed to improve auditing and debugging of cleanup activity.

Steps to reproduce

  1. Create orphaned custom block content entities
  2. Run orphan cleanup operations
  3. Observe that orphaned blocks are deleted immediately without a preview mode
  4. Observe that cleanup actions are not logged for auditing purposes

Proposed resolution

  • Add a $dry_run parameter to orphan cleanup operations
  • Allow cleanup processes to simulate deletions without modifying entities
  • Add logging support using the block_content_explorer logger channel
  • Log dry-run operations separately from actual deletions
  • Return the number of processed orphaned blocks

Remaining tasks

  • Add dry-run support to cleanup operations
  • Add logger dependency injection
  • Register module logger channel service
  • Add logging for simulated cleanup operations
  • Add logging for actual deletion operations
  • Test dry-run behavior using drush php-eval
  • Verify cleanup logs appear in Recent log messages

User interface changes

None.

API changes

  • Adds dry-run support to orphan cleanup operations
  • Adds logger integration for cleanup actions

Data model changes

None.

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.

mohnish s. yadav’s picture

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

Status: Needs review » 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.