You are here

linkchecker.install in Link checker 5

File

linkchecker.install
View source
<?php

// $Id$

/**
 * Implementation of hook_install().
 */
function linkchecker_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query(" CREATE TABLE `linkchecker_tasks` (\n                `taskid` int(10) unsigned NOT NULL default '0',\n                `nodeid` int(10) NOT NULL default '0',\n                `status` int(10) NOT NULL default '0',\n                `update` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n                 PRIMARY KEY  (`taskid`)\n                 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
      db_query(" CREATE TABLE `linkchecker_results` (\n                 `taskid` int(10) NOT NULL default '0',\n                 `url` text NOT NULL,\n                 `response` varchar(255) NOT NULL default '0',\n                 KEY `taskid` (`taskid`)\n                 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n         ");
      db_query("INSERT INTO `linkchecker_tasks` ( `taskid` , `nodeid` , `status` , `update` )\n                 VALUES ('0', '0', '0', '0');");
      break;
  }
}

/**
 * Implementation of hook_uninstall().
 */
function linkchecker_uninstall() {
  db_query('DROP TABLE {linkchecker_tasks}');
  db_query('DROP TABLE {linkchecker_results}');
}

/**
 * Update table definitions.
 */
function linkchecker_update_1000() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("CREATE TABLE `linkchecker_tasks` (\n                 `taskid` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT ,\n                 `nodeid` INT( 10 ) NOT NULL ,\n                 `status` INT( 10 ) DEFAULT '0' NOT NULL ,\n                 `update` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,\n                  PRIMARY KEY ( `taskid` )\n                 ) TYPE = MYISAM;");
      $ret[] = update_sql("CREATE TABLE `linkchecker_results` (\n                 `taskid` int(10) NOT NULL default '0',\n                 `url` text NOT NULL,\n                 `response` varchar(255) NOT NULL default '0',\n                 KEY `taskid` (`taskid`)\n                 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; ");
      break;
  }
  return $ret;
}

Functions

Namesort descending Description
linkchecker_install Implementation of hook_install().
linkchecker_uninstall Implementation of hook_uninstall().
linkchecker_update_1000 Update table definitions.