Skip to content

Instantly share code, notes, and snippets.

@Cyclodex
Created June 14, 2017 15:33
Show Gist options
  • Save Cyclodex/70378e2f3f72a91fc55d2913404fcde0 to your computer and use it in GitHub Desktop.
Save Cyclodex/70378e2f3f72a91fc55d2913404fcde0 to your computer and use it in GitHub Desktop.
Drupal cleanup old modules when missing from file system
/**
* Delete {system} records for long-lost modules.
*/
function HOOK_update_7100() {
$modules = array(
'module1',
'module2',
'module3',
);
db_delete('system')
->condition('name', $modules, 'IN')
->condition('type', 'module')
->execute();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment