You are here

function linkchecker_install in Link checker 5.2

Same name and namespace in other branches
  1. 8 linkchecker.install \linkchecker_install()
  2. 5 linkchecker.install \linkchecker_install()
  3. 6.2 linkchecker.install \linkchecker_install()
  4. 7 linkchecker.install \linkchecker_install()

Implementation of hook_install().

File

./linkchecker.install, line 13
Installation file for Link Checker module.

Code

function linkchecker_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {linkchecker_boxes} (\n        bid INT unsigned NOT NULL,\n        lid INT unsigned NOT NULL,\n        PRIMARY KEY (bid, lid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {linkchecker_nodes} (\n        nid INT unsigned NOT NULL,\n        lid INT unsigned NOT NULL,\n        PRIMARY KEY (nid, lid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {linkchecker_comments} (\n        cid INT unsigned NOT NULL,\n        lid INT unsigned NOT NULL,\n        PRIMARY KEY (cid ,lid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      db_query("CREATE TABLE {linkchecker_links} (\n        lid INT unsigned NOT NULL,\n        token VARCHAR(32) NOT NULL,\n        url TEXT NOT NULL,\n        method varchar(4) NOT NULL default 'HEAD',\n        code INT NOT NULL default '-1',\n        error TEXT,\n        fail_count INT NOT NULL default '0',\n        last_checked INT NOT NULL default '0',\n        status INT NOT NULL default '1',\n        PRIMARY KEY (lid),\n        UNIQUE KEY token (token)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;

    // PgSQL is untested!
    case 'pgsql':
      db_query("CREATE TABLE {linkchecker_boxes} (\n        bid int_unsigned NOT NULL,\n        lid int_unsigned NOT NULL,\n        PRIMARY KEY (bid, lid)\n      );");
      db_query("CREATE TABLE {linkchecker_nodes} (\n        nid int_unsigned NOT NULL,\n        lid int_unsigned NOT NULL,\n        PRIMARY KEY (nid, lid)\n      );");
      db_query("CREATE TABLE {linkchecker_comments} (\n        cid int_unsigned NOT NULL,\n        lid int_unsigned NOT NULL,\n        PRIMARY KEY (cid, lid)\n      );");
      db_query("CREATE TABLE {linkchecker_links} (\n        lid int_unsigned NOT NULL,\n        token VARCHAR(32) NOT NULL,\n        url TEXT NOT NULL,\n        method VARCHAR(4) NOT NULL default 'HEAD',\n        code INTEGER NOT NULL default '-1',\n        error TEXT,\n        fail_count INTEGER NOT NULL default '0',\n        last_checked INTEGER NOT NULL default '0',\n        status INT NOT NULL default '1',\n        PRIMARY KEY (lid),\n        UNIQUE (token)\n      );");
      break;
  }
}