You are here

function feedapi_install in FeedAPI 5

Same name and namespace in other branches
  1. 6 feedapi.install \feedapi_install()

Implementation of hook_install().

File

./feedapi.install, line 6

Code

function feedapi_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      db_query("CREATE TABLE if not exists {feedapi} (\n        nid int(10) unsigned NOT NULL default '0',\n        url text,\n        feed_type varchar(50) NOT NULL default '',\n        processors varchar(255) NOT NULL default '',\n        parsers varchar(255) NOT NULL default '',\n        checked int(10) NOT NULL default '0',\n        hash varchar(32),\n        link text,\n        settings longtext,\n        half_done tinyint,\n        skip tinyint(1) NOT NULL default '0',\n        KEY(skip),\n        PRIMARY KEY(nid))\n      ");
      db_query("CREATE TABLE {feedapi_stat} (\n        id INT(10) unsigned NOT NULL default '0',\n        type VARCHAR(64) NOT NULL,\n        timestamp INT(11) NOT NULL,\n        time VARCHAR(20) NOT NULL,\n        value INT(11) NOT NULL,\n        INDEX (id, type, timestamp, time));\n      ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {feedapi} (\n        nid int NOT NULL default '0',\n        url text,\n        feed_type varchar(50) NOT NULL default '',\n        processors varchar(255) NOT NULL default '',\n        parsers varchar(255) NOT NULL default '',\n        checked integer NOT NULL,\n        hash varchar(32),\n        link text,\n        settings text,\n        half_done smallint,\n        skip smallint NOT NULL default '0',\n        PRIMARY KEY(nid))\n      ");
      db_query("CREATE TABLE {feedapi_stat} (\n        id int NOT NULL default '0',\n        type VARCHAR(64) NOT NULL,\n        timestamp INT NOT NULL,\n        time VARCHAR(20) NOT NULL,\n        value INT NOT NULL)\n      ");
      db_query("CREATE INDEX {feedapi_stat}_id_type_timestamp_time_idx ON {feedapi_stat} (id, type, timestamp, time)");
      db_query("CREATE INDEX {feedapi}_skip_idx ON {feedapi} (skip)");
      break;
  }

  // This value warrants that og, taxonomy and similar modules does their job before feedapi. This is important
  // because of for example feedapi_inherit or whatever processor which needs a 3rd-party processed data.
  db_query("UPDATE {system} SET weight = 5 WHERE name = 'feedapi'");
}