You are here

function better_watchdog_ui_disable in Better Watchdog UI 8

Same name and namespace in other branches
  1. 7.3 better_watchdog_ui.install \better_watchdog_ui_disable()
  2. 7 better_watchdog_ui.install \better_watchdog_ui_disable()
  3. 7.2 better_watchdog_ui.install \better_watchdog_ui_disable()

Implements hook_disable().

File

./better_watchdog_ui.install, line 41
Installation and update functions.

Code

function better_watchdog_ui_disable() {

  // Reset the weight to be smaller than the dblog module.
  $weight = db_select('system', 's')
    ->fields('s', array(
    'weight',
  ))
    ->condition('s.name', 'dblog', '=')
    ->condition('type', 'module')
    ->execute()
    ->fetchField();
  db_update('system')
    ->fields(array(
    'weight' => $weight - 1,
  ))
    ->condition('name', 'better_watchdog_ui')
    ->condition('type', 'module')
    ->execute();

  // Disable watchdog view.
  module_load_include('inc', 'better_watchdog_ui', 'better_watchdog_ui/better_watchdog_ui.views_default');
  $views_status = variable_get('views_defaults', array());
  if (array_key_exists('better_watchdog_ui_view', $views_status)) {

    // TRUE means disable.
    $views_status['better_watchdog_ui_view'] = FALSE;
    variable_set('views_defaults', $views_status);
    views_invalidate_cache();
  }
}