function comment_notify_install in Comment Notify 5
Same name and namespace in other branches
- 8 comment_notify.install \comment_notify_install()
- 5.2 comment_notify.install \comment_notify_install()
- 6 comment_notify.install \comment_notify_install()
- 7 comment_notify.install \comment_notify_install()
Implementation of hook_install().
1 call to comment_notify_install()
File
- ./
comment_notify.install, line 6
Code
function comment_notify_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$status[] = db_query("\n ALTER TABLE {comments}\n ADD COLUMN `notify` tinyint(1) NOT NULL DEFAULT '0'");
break;
case 'pgsql':
$status[] = db_query("\n ALTER TABLE {comments}\n ADD COLUMN `notify` tinyint(1) NOT NULL DEFAULT '0'");
break;
}
// Set module weight for my module
$status[] = db_query("UPDATE {system} SET weight = 10 WHERE name = 'comment_notify'");
// If there is one FALSE value in the status array, there was an error.
if (array_search(FALSE, $status) !== FALSE) {
drupal_set_message(t('Database modifications for the comment_notify module was unsuccessful. The modifications may need to be made by hand.'), 'error');
}
else {
drupal_set_message(t('comment_notify module installed successfully.'));
}
}