function maillog_enable in Maillog / Mail Developer 7
Same name and namespace in other branches
- 6 maillog.install \maillog_enable()
Implements hook_enable().
File
- ./
maillog.install, line 11 - Provides the installation routines for the maillog module.
Code
function maillog_enable() {
// The system default class.
$default_class = 'DefaultMailSystem';
// Load the current mail configuration.
$mail_system = variable_get('mail_system', array(
'default-system' => $default_class,
));
$mail_system['maillog'] = 'MaillogMailSystem';
// If maillog is enabled, don't take over the default.
if ($mail_system['default-system'] == $default_class) {
$mail_system['default-system'] = $mail_system['maillog'];
}
else {
drupal_set_message(t('The Maillog module was not set as the default email system because another module is already handling email.'));
}
// Update the settings.
variable_set('mail_system', $mail_system);
// The maillog reports page is provided by a view, but it needs a menu cache
// clear after the default views are loaded in order for the menu item to
// become active.
global $language;
cache_clear_all('ctools_plugin_files:ctools:export_ui', 'cache');
cache_clear_all('ctools_plugin_type_info', 'cache');
cache_clear_all('views:plugin_data:' . $language->language, 'cache');
variable_set('menu_rebuild_needed', TRUE);
}