function flashnode_install in Flash Node 5.3
Same name and namespace in other branches
- 5.6 flashnode.install \flashnode_install()
- 5.2 flashnode.install \flashnode_install()
- 6.3 flashnode.install \flashnode_install()
- 6.2 flashnode.install \flashnode_install()
Implementation of hook_install().
flashnode used to be just flash, so we need to check if {flash} table already exists when we install flashnode. If it does then we need to rename it, otherwise we install the table as normal
File
- ./
flashnode.install, line 10
Code
function flashnode_install() {
if (db_table_exists('flash')) {
// Migrating from an earlier version of flash
_flashnode_migrate_from_flash();
}
else {
// first install - create the table
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query('
CREATE TABLE {flashnode} (
nid INT(10) UNSIGNED NOT NULL ,
height INT(10) UNSIGNED NOT NULL ,
width INT(10) UNSIGNED NOT NULL ,
display TINYINT(3) UNSIGNED NOT NULL ,
substitution LONGTEXT NOT NULL ,
flashvars LONGTEXT NOT NULL ,
base VARCHAR(255) DEFAULT NULL ,
vid INT(10) UNSIGNED NOT NULL ,
fid INT(10) UNSIGNED NOT NULL ,
PRIMARY KEY (nid)
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;');
break;
case 'pgsql':
db_query("\n create table {flashnode} (\n nid integer not null,\n height integer not null,\n width integer not null,\n display integer not null,\n substitution text not null default '',\n flashvars text not null default '',\n base VARCHAR(255) default NULL,\n vid integer not null,\n fid integer not null,\n PRIMARY KEY (nid)\n );");
break;
}
}
drupal_set_message(t('Flash node has been setup.'));
}