You are here

replication.install in Replication 5

Same filename and directory in other branches
  1. 8.2 replication.install
  2. 8 replication.install
  3. 5.0 replication.install

File

replication.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function replication_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {replication} (\n        `slaveid` varchar(10) NOT NULL,\n        `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n        PRIMARY KEY  (`slaveid`)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */");
      drupal_set_message("Please ensure that you correctly patch your includes/database.mysql.inc files!");
      break;
    case 'pgsql':
      drupal_set_message("Your database is not supported by this module");
      break;
  }
}

/**
 * Implementation of hook_uninstall().
 */
function replication_uninstall() {
  db_query("DROP TABLE {replication}");
  variable_del('replication_online');
  variable_del('replication_admin_identifier');
  variable_del('replication_admin_normal_theme');
  variable_del('replication_admin_warning_theme');
  variable_del('replication_admin_max_recheck');
  variable_del('replication_admin_wait_recheck');
  variable_del('replication_server_mode');
  variable_del('replication_server_url');
  variable_del('replication_http_timeout');
  variable_del('replication_http_speedlimit');
  variable_del('replication_http_retries');
  variable_del('replication_http_port');
  variable_del('replication_http_connect');
  variable_del('replication_timestamp');
}

/**
 * Implementation of hook_update
 **/
function replication_update_1() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("CREATE TABLE {replication} (\n        `slaveid` varchar(10) NOT NULL,\n        `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n        PRIMARY KEY  (`slaveid`)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */");
      drupal_set_message("Please ensure that you correctly patch your includes/database.mysql.inc files!");
      break;
    case 'pgsql':
      drupal_set_message("Your database is not supported by this module");
      break;
  }
  return $ret;
}

Functions

Namesort descending Description
replication_install Implementation of hook_install().
replication_uninstall Implementation of hook_uninstall().
replication_update_1 Implementation of hook_update