You are here

function htmlpurifier_update_1 in HTML Purifier 5

File

./htmlpurifier.install, line 79

Code

function htmlpurifier_update_1() {
  _htmlpurifier_version_check();
  $ret = array();
  $result = db_query("SHOW TABLES LIKE '{cache_htmlpurifier}'");
  if (!db_fetch_array($result)) {
    switch ($GLOBALS['db_type']) {
      case 'mysql':
      case 'mysqli':
        $ret[] = update_sql("CREATE TABLE {cache_htmlpurifier} (\n            cid varchar(255) NOT NULL default '',\n            data longblob,\n            expire int NOT NULL default '0',\n            created int NOT NULL default '0',\n            headers text,\n            PRIMARY KEY (cid),\n            INDEX expire (expire)\n          ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
        break;
      case 'pgsql':
        $ret[] = update_sql("CREATE TABLE {cache_htmlpurifier} (\n            cid varchar(255) NOT NULL default '',\n            data bytea,\n            expire int NOT NULL default '0',\n            created int NOT NULL default '0',\n            headers text,\n            PRIMARY KEY (cid)\n          )");
        $ret[] = update_sql("CREATE INDEX {cache_htmlpurifier}_expire_idx ON {cache_htmlpurifier} (expire)");
        break;
    }
  }
  return $ret;
}