View source
<?php
function notify_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$created = db_query("CREATE TABLE IF NOT EXISTS {notify} (\n uid INT(10) UNSIGNED NOT NULL DEFAULT '0',\n status TINYINT(2) NOT NULL DEFAULT '0',\n node TINYINT(2) NOT NULL DEFAULT '0',\n comment TINYINT(2) NOT NULL DEFAULT '0',\n attempts TINYINT(4) NOT NULL DEFAULT '0',\n teasers TINYINT(4) NOT NULL DEFAULT '0',\n PRIMARY KEY (uid)\n ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
break;
case 'pgsql':
$created = db_query("CREATE TABLE {notify} (\n uid integer NOT NULL DEFAULT '0',\n status integer NOT NULL DEFAULT '0',\n node integer NOT NULL DEFAULT '0',\n comment integer NOT NULL DEFAULT '0',\n attempts integer NOT NULL DEFAULT '0',\n teasers integer NOT NULL DEFAULT '0',\n PRIMARY KEY (uid)\n );");
break;
}
if ($created) {
drupal_set_message(t('Notify module installed successfully.'));
}
else {
drupal_set_message(t('Table installation for the Notify module was unsuccessful. The tables may need to be installed by hand.'), 'error');
}
$weight = (int) db_result(db_query("SELECT weight FROM {system} WHERE name = 'scheduler'"));
$weight += 10;
db_query("UPDATE {system} SET weight = %d WHERE name = 'notify'", $weight);
}
function notify_update_1() {
$ret = array();
$weight = (int) db_result(db_query("SELECT weight FROM {system} WHERE name = 'scheduler'"));
$weight += 10;
$ret[] = update_sql("UPDATE {system} SET weight = {$weight} WHERE name = 'notify'");
return $ret;
}