Detect and remove "enabled but missing" modules.

Public

Description of the problem

Get raw version
text
  1. When Drupal boostraps, if an enabled module or theme is missing from the filesystem, it will scan all directories in search for it, on EVERY page request (!) resulting in a massive overhead.
  2. More info and patch https://drupal.org/node/1081266#comment-6874620
  3.  
  4. Note: for PostgreSQL replace "--skip-column-names" by "-t"

Detect enabled modules or files that are slowing Drupal.

Get raw version
bash
  1. for FN in `drush --extra=--skip-column-names sql-query "SELECT filename FROM system WHERE status = 1"`; do [ ! -f $FN ] && echo "Missing $FN"; done

Remove missing files from system table.

Get raw version
php
  1. for FN in `drush --extra=--skip-column-names sql-query "SELECT filename FROM system WHERE status = 1"`; do [ ! -f $FN ] && drush sqlq "DELETE FROM system WHERE filename = '$FN';" && echo "Removed $FN"; done