You are here

function _patchinfo_clear_db in PatchInfo 8.2

Same name and namespace in other branches
  1. 8 patchinfo.module \_patchinfo_clear_db()
  2. 7 patchinfo.module \_patchinfo_clear_db()

Remove all patch information for a module from DB.

Parameters

string $module: Machine readable module name.

1 call to _patchinfo_clear_db()
patchinfo_system_info_alter in ./patchinfo.module
Implements hook_system_info_alter().

File

./patchinfo.module, line 142
Patch Info primary module file.

Code

function _patchinfo_clear_db($module) {
  if (!empty($module)) {

    // We need to wrap this in a try/catch, sice the code might be called during
    // the update process from 8.x-1.x when the source_module field is still
    // missing. The alternative would be to check the schema everytime, which
    // would be much more expensive.
    try {
      \Drupal::database()
        ->delete('patchinfo')
        ->condition('source_module', $module)
        ->execute();
    } catch (Exception $e) {
      watchdog_exception('patchinfo', $e);
    }
  }
}