signature_forum.install in Signatures for Forums 5
File
signature_forum.install
View source
<?php
function signature_forum_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {users_signature} (\n uid int NOT NULL default '0',\n signature text,\n PRIMARY KEY (uid)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
break;
case 'pgsql':
db_query("CREATE TABLE {users_signature} (\n uid int NOT NULL default '0',\n signature text,\n PRIMARY KEY (uid)\n )");
break;
}
}
function signature_forum_uninstall() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("UPDATE {users}, {users_signature}\n SET {users}.signature={users_signature}.signature\n WHERE {users}.uid={users_signature}.uid");
break;
case 'pgsql':
db_query("UPDATE {users} SET signature={users_signature}.signature FROM {users_signature}\n WHERE {users}.uid={users_signature}.uid");
break;
}
db_query("DROP TABLE {users_signature}");
variable_del('signature_forum_settings');
}
function signature_forum_update_1() {
$ret = array();
foreach (node_get_types('names') as $type => $name) {
$settings['signature_forum_show_for_' . $type] = variable_get('signature_forum_show_for_' . $type, 0);
variable_del('signature_forum_show_for_' . $type);
}
$settings['signature_forum_template'] = variable_get('signature_forum_template', "__________________\n<p>%s</p>");
$settings['signature_forum_format'] = variable_get('signature_forum_format', FILTER_FORMAT_DEFAULT);
$settings['signature_forum_line_limit'] = variable_get('signature_forum_line_limit', 0);
$settings['signature_forum_min_content_length'] = variable_get('signature_forum_min_content_length', 0);
$settings['signature_forum_min_content_length_action'] = variable_get('signature_forum_min_content_length_action', 0);
$settings['signature_forum_min_content_length_filter'] = variable_get('signature_forum_min_content_length_filter', FILTER_FORMAT_DEFAULT);
variable_set('signature_forum_settings', $settings);
variable_del('signature_forum_template');
variable_del('signature_forum_format');
variable_del('signature_forum_line_limit');
variable_del('signature_forum_min_content_length');
variable_del('signature_forum_min_content_length_action');
variable_del('signature_forum_min_content_length_filter');
variable_del('signature_forum_roles');
return $ret;
}
function signature_forum_update_2() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {users_signature} MODIFY uid integer");
$ret[] = update_sql("ALTER TABLE {users_signature} MODIFY signature text default NULL");
break;
}
return $ret;
}