comment_notify.install in Comment Notify 5
File
comment_notify.install
View source
<?php
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;
}
$status[] = db_query("UPDATE {system} SET weight = 10 WHERE name = 'comment_notify'");
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.'));
}
}
function comment_notify_update_1() {
comment_notify_install();
}
function comment_notify_update_2() {
$result = db_query("UPDATE {system} SET weight = 10 WHERE name = 'comment_notify'");
drupal_set_message($results);
if ($result) {
drupal_set_message(t('comment_notify module weight config update successfully.'));
}
else {
drupal_set_message(t('comment_notify module weight config update unsuccessful.'), 'error');
}
$ret[] = $result;
return $ret;
}
function comment_notify_update_3() {
$result = db_query("UPDATE {variable} SET value = replace(value, '%', '!') WHERE name = 'comment_notify_default_mailtext'");
drupal_set_message($results);
if ($result) {
drupal_set_message(t('comment_notify mail text migration successful.'));
}
else {
drupal_set_message(t('comment_notify mail text migration unsuccessful.'), 'error');
}
$ret[] = $result;
return $ret;
}
function comment_notify_update_4() {
$ret = array();
$ret[] = update_sql("ALTER TABLE {comments} MODIFY notify tinyint(1) NOT NULL DEFAULT '0'");
return $ret;
}