Tracking inactive bundle classes

Created on 22 September 2023, over 1 year ago
Updated 12 December 2023, over 1 year ago

Problem/Motivation

Hello, thanks for this module. I have encountered the problem of unused bundle classes several times, would you like to add logging if the class exists but the bundle does not?

Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kksandr
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Custom Commands Failed
  • @kksandr opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇦🇺Australia mstrelan

    Can you explain the problem a little more? I can't see how this would come up, at least not in the workflow I'm used to.

  • 🇦🇺Australia dpi Perth, Australia

    The idea is to remove code if it matches a deleted or mistyped bundle ID. I reckon this deserves escalation to an Exception. Logs are just going to get lost.

  • 🇦🇺Australia mstrelan

    Who says people don't write bundle classes before creating the bundle? Maybe some day someone will write a drush command to discover bundle classes and create bundles from them. Also, what happens on config import when a new bundle (with bundle class) is imported? I think anything like this is up to core to deal with, it's no different to deleting a bundle but keeping the hook and class, except in this case you don't need to worry about the hook.

  • 🇦🇺Australia dpi Perth, Australia

    Good points

    Also, what happens on config import when a new bundle

    I imagine this wouldnt be a factor, config import and container build are different processes. Unless theres something im not aware of there.

    's no different to deleting a bundle but keeping the hook and class,

    Only because we dont have a hook registry, so we cant do anything intelligent. We can do better here.

  • 🇦🇺Australia mstrelan

    I imagine this wouldnt be a factor, config import and container build are different processes. Unless theres something im not aware of there.

    When drush deploy runs it does the following:

    drush updatedb --no-cache-clear
    drush cache:rebuild
    drush config:import
    drush cache:rebuild
    drush deploy:hook
    

    During the drush cache:rebuild step bca_entity_bundle_info_alter is invoked. Since the new bundles have not been imported yet we'd be throwing an exception here.

  • 🇦🇺Australia dpi Perth, Australia

    Other possibilities? An entry on Drupal status page?

  • Can you explain the problem a little more?

    In my projects, I came across the fact that we had unused bundle classes. This would help in cleaning up unnecessary code.

    Who says people don't write bundle classes before creating the bundle?

    I never thought about this use case. We could introduce an option in the annotation that would enable the usage check to be ignored, which is disabled by default.

    An entry on Drupal status page?

    Also a good option.

Production build 0.71.5 2024