Skip to content

Instantly share code, notes, and snippets.

@balbuf
Created July 19, 2018 19:06
Show Gist options
  • Save balbuf/10b04d80a3447945d7ee65a42924785a to your computer and use it in GitHub Desktop.
Save balbuf/10b04d80a3447945d7ee65a42924785a to your computer and use it in GitHub Desktop.
List modules that are missing from the filesystem using drush (Drupal 8)
drush updatedb-status 2>&1 > /dev/null | sed 's/\[warning\]//g' | tr '\n' ' ' | sed 's/bootstrap[^ ]* */\n/g' | grep 'module is missing' | sed -E 's/.*: *([^ ]+) */\1/g'
# annotated version:
drush updatedb-status 2>&1 > /dev/null | # use updatedb-status because it will print an error message for each missing module but not make any changes to the drupal site; 2>&1 > /dev/null keeps only the error output
sed 's/\[warning\]//g' | # strip the string "[warning]" from the output
tr '\n' ' ' | # convert line breaks to spaces, because the lines get broken in odd spots due to an 80-character line length limit
sed 's/bootstrap[^ ]* */\n/g' | # replace the pattern "bootstrap*" with a line break, because each separate warning ends with this string
grep 'module is missing' | # filter down to only lines containing the string "module is missing"
sed -E 's/.*: *([^ ]+) */\1/g' # strip everything but the word that appears after a colon, which is the module name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment