You are here

block_class.install in Block Class 5

File

block_class.install
View source
<?php

function block_class_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query('CREATE TABLE IF NOT EXISTS {block_class} (
          `module` varchar(50) NOT NULL,
          `delta` varchar(32) NOT NULL,
          `css_class` varchar(50) NOT NULL,
          PRIMARY KEY  (`module`,`delta`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
      if (db_table_exists('pressflow_block_class')) {
        db_query('INSERT INTO {block_class} (module, delta, css_class) SELECT module, delta, css_class FROM {pressflow_block_class}');
      }
      drupal_set_message('Block Class successfully installed.');
  }
}
function block_class_update_3() {
  $ret = array();
  $ret[] = update_sql('ALTER TABLE `block_class` CHANGE `delta` `delta` varchar(32) NOT NULL');
  return $ret;
}
function block_class_update_4() {
  $ret = array();
  $ret[] = update_sql('ALTER TABLE `block_class` CHANGE `delta` `delta` varchar(32) NOT NULL');
  return $ret;
}
function block_class_uninstall() {
  db_query('DROP TABLE IF EXISTS {block_class} CASCADE');
}