function better_watchdog_ui_enable in Better Watchdog UI 8
Same name and namespace in other branches
- 7.3 better_watchdog_ui.install \better_watchdog_ui_enable()
- 7 better_watchdog_ui.install \better_watchdog_ui_enable()
- 7.2 better_watchdog_ui.install \better_watchdog_ui_enable()
Implements hook_enable().
File
- ./
better_watchdog_ui.install, line 11 - Installation and update functions.
Code
function better_watchdog_ui_enable() {
// Allow our view to override the basic watchdog listing
// by increasing module weight in system database table.
$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();
// Enable 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'] = TRUE;
variable_set('views_defaults', $views_status);
views_invalidate_cache();
}
}