scanner.install in Search and Replace Scanner 5.2
Same filename and directory in other branches
Search and Replace Scanner install - creates necessary tables.
File
scanner.installView source
<?php
/**
* @file
* Search and Replace Scanner install - creates necessary tables.
*/
/**
* Implementation of hook_install().
*/
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');
}
}
/**
* Implementation of hook_uninstall().
*/
function scanner_uninstall() {
db_query('DROP TABLE {scanner}');
db_query("DELETE FROM {variable} WHERE name LIKE 'scanner_%'");
}
Functions
Name | Description |
---|---|
scanner_install | Implementation of hook_install(). |
scanner_uninstall | Implementation of hook_uninstall(). |