You are here

feed_path_publisher.install in Feed Path Publisher 5

Same filename and directory in other branches
  1. 6 feed_path_publisher.install
  2. 7 feed_path_publisher.install

File

feed_path_publisher.install
View source
<?php

function feed_path_publisher_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query('CREATE TABLE {feed_path_publisher} (
        fppid int(10) unsigned NOT NULL auto_increment,
        title varchar(50) NOT NULL,
        path_prefix varchar(100) NOT NULL,
        feed varchar(200) NOT NULL,
        weight int(11) NOT NULL,
        PRIMARY KEY  (fppid),
        UNIQUE KEY path_prefix (path_prefix, feed),
        KEY listing (weight, path_prefix, title)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
      db_query('CREATE TABLE {feed_path_publisher_roles} (
        fpprid int(10) unsigned NOT NULL auto_increment,
        fppid int(10) unsigned NOT NULL,
        show_hide varchar(50) NOT NULL,
        rids varchar(100) NOT NULL,
        PRIMARY KEY  (fpprid)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
      break;
    case 'pgsql':
      drupal_set_message('PostgreSQL is not currently supported.', 'error');
      break;
  }
}
function feed_path_publisher_uninstall() {
  db_query('DROP TABLE {feed_path_publisher}');
}
function feed_path_publisher_update_1() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql('ALTER TABLE {feed_path_publisher} ADD weight INT NOT NULL');
      $ret[] = update_sql('ALTER TABLE {feed_path_publisher} DROP INDEX listing, ADD INDEX listing (weight, path_prefix, title)');
      break;
    case 'pgsql':
      drupal_set_message('PostgreSQL is not currently supported.', 'error');
      break;
  }
  return $ret;
}
function feed_path_publisher_update_2() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query('CREATE TABLE {feed_path_publisher2} (
        fppid int(10) unsigned NOT NULL auto_increment,
        title varchar(50) NOT NULL,
        path_prefix varchar(100) NOT NULL,
        feed varchar(200) NOT NULL,
        weight int(11) NOT NULL,
        PRIMARY KEY  (fppid),
        UNIQUE KEY path_prefix (path_prefix, feed),
        KEY listing (weight, path_prefix, title)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8  as (select * from {feed_path_publisher});');
      db_query('DROP TABLE {feed_path_publisher}');
      db_query('CREATE TABLE {feed_path_publisher} (
        fppid int(10) unsigned NOT NULL auto_increment,
        title varchar(50) NOT NULL,
        path_prefix varchar(100) NOT NULL,
        feed varchar(200) NOT NULL,
        weight int(11) NOT NULL,
        PRIMARY KEY  (fppid),
        UNIQUE KEY path_prefix (path_prefix, feed),
        KEY listing (weight, path_prefix, title)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8  as (select * from {feed_path_publisher2});');
      db_query('DROP TABLE {feed_path_publisher2}');
      break;
    case 'pgsql':
      drupal_set_message('PostgreSQL is not currently supported.', 'error');
      break;
  }
  return $ret;
}
function feed_path_publisher_update_3() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query('CREATE TABLE {feed_path_publisher_roles} (
        fpprid int(10) unsigned NOT NULL auto_increment,
        fppid int(10) unsigned NOT NULL,
        show_hide varchar(50) NOT NULL,
        rids varchar(100) NOT NULL,
        PRIMARY KEY  (fpprid)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
      break;
    case 'pgsql':
      drupal_set_message('PostgreSQL is not currently supported.', 'error');
      break;
  }
  return $ret;
}