function scanner_install in Search and Replace Scanner 5.2
Same name and namespace in other branches
- 6 scanner.install \scanner_install()
Implementation of hook_install().
File
- ./
scanner.install, line 11 - Search and Replace Scanner install - creates necessary tables.
Code
function scanner_install() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysqli':
case 'mysql':
$ret[] = db_query("\n CREATE TABLE {scanner} (\n undo_id int(11) NOT NULL,\n undo_data longtext NOT NULL,\n undone tinyint(4) NOT NULL,\n searched varchar(256) NOT NULL,\n replaced varchar(256) NOT NULL,\n count int(11) NOT NULL,\n time int(11) NOT NULL,\n PRIMARY KEY (undo_id)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
break;
}
if (!in_array(false, $ret)) {
drupal_set_message(t('Scanner module installed successfully.'));
}
else {
drupal_set_message(t('The installation of the scanner module was unsuccessful due to a database error. You may have to install the tables by hand.'), 'error');
}
}