Jump to content

ICT:Drupal Dead Custom Module Check

From Costa Sano MediaWiki
Revision as of 18:08, 19 March 2026 by Mngr (talk | contribs) (Created page with "= Dead Module Checklist (Safe Removal Procedure) = This checklist provides a systematic, successor‑friendly method to determine whether a custom Drupal module is still in use. A module may only be deleted after all checks are completed. == 1. Check for Entity Types == If the module defines any entity types, it is almost certainly still in use. Look inside the module folder: * <pre>src/Entity</pre> * <pre>config/install</pre> If you find: * content entities *...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Dead Module Checklist (Safe Removal Procedure)

This checklist provides a systematic, successor‑friendly method to determine whether a custom Drupal module is still in use. A module may only be deleted after all checks are completed.

1. Check for Entity Types

If the module defines any entity types, it is almost certainly still in use.

Look inside the module folder:

  • src/Entity
  • config/install

If you find:

  • content entities
  • config entities
  • field types
  • field widgets
  • field formatters

→ The module is still structurally relevant.

If these folders are empty → good sign.


2. Check for Routes

Routes may be used by Views, menus, AJAX callbacks, or forms.

Look for:

  • my_module.routing.yml
  • my_module.links.menu.yml
  • my_module.links.action.yml
  • my_module.links.task.yml

If these files exist, search the Drupal UI for references:

  • Views
  • Menus
  • Local tasks
  • Custom pages

If nothing references them → safe.


3. Check for Services

Services may be used by other modules, Views handlers, or preprocess functions.

Look for:

  • my_module.services.yml

If present, open it and check:

  • Is any other module calling these services?
  • Is any theme calling them?
  • Is any hook using them?

If no references exist → safe.


4. Check for Hooks

Hooks can influence:

  • entity forms
  • entity saves
  • validation
  • rendering
  • permissions
  • access control
  • Views integration

Search inside the module for:

function my_module_

If you find:

  • hook_form_alter
  • hook_entity_presave
  • hook_entity_view
  • hook_views_data
  • hook_theme

→ The module may still affect behavior.

If the module contains **no hooks** → very safe.


5. Check for Views Dependencies

Views may reference:

  • custom tables
  • custom fields
  • custom handlers
  • custom routes
  • custom plugins

Go to:

/admin/structure/views

Search for:

  • the module name
  • any table names it defines
  • any field names it defines

If no View references the module → safe.


6. Check for Form or Field Widgets

Modules may define:

  • custom widgets
  • custom formatters
  • custom validation

Look for:

  • src/Plugin/Field/FieldWidget
  • src/Plugin/Field/FieldFormatter
  • src/Plugin/Validation

If these exist, verify they are not used by any field.


7. Check for Theme Hooks

Look for:

  • hook_theme()
  • templates/

If templates exist, check if any theme or View uses them.


8. Check for Dependencies in Other Modules

Search the codebase for the module name:

grep -R "my_module" web/modules
grep -R "my_module" web/themes

If nothing references it → safe.


9. Disable the Module on a Clone (Final Test)

This is the ultimate safety check.

Steps:

  1. Clone the site (local or staging).
  2. Disable the module:
drush pm:uninstall my_module
  1. Clear caches:
drush cr
  1. Test:
  • Object edit
  • Asset edit
  • Media Library
  • File uploads
  • Views
  • Forms
  • Custom workflows

If everything works → the module is truly unused.


10. Dead Module Checklist (Printable)

A module is safe to delete if:

  • [ ] No entity types
  • [ ] No field types
  • [ ] No plugins
  • [ ] No routes in use
  • [ ] No services in use
  • [ ] No hooks affecting behavior
  • [ ] No Views referencing it
  • [ ] No forms referencing it
  • [ ] No other modules depend on it
  • [ ] Site works normally with module disabled

If all boxes are checked → the module can be safely removed.


Status

This checklist is the recommended procedure for verifying unused custom modules before deletion.