disqus_migrate.install in Disqus 6
The install and update hooks for the Disqus module.
File
disqus_migrate.installView source
<?php
/**
* @file
* The install and update hooks for the Disqus module.
*/
/**
* Implementation of hook_install
*/
function disqus_migrate_install() {
drupal_install_schema('disqus_migrate');
}
/**
* Implementation of hook_uninstall
*/
function disqus_migrate_uninstall() {
drupal_uninstall_schema('disqus_migrate');
variable_del('disqus_migrate_export_status_alter');
variable_del('disqus_migrate_export_api_limit');
variable_del('disqus_migrate_import_stop_on_errors');
variable_del('disqus_migrate_import_sync_enabled');
variable_del('disqus_migrate_import_sync_interval');
}
/**
* Implementation of hook_schema().
*/
function disqus_migrate_schema() {
$schema['disqus_migrate'] = array(
'description' => 'Holds associations of Disqus comment IDs to Drupal Comment IDs.',
'fields' => array(
'did' => array(
'description' => 'The primary identifier for the Disqus comment.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'dtid' => array(
'description' => 'The Disqus thread ID that the comment belongs to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'description' => 'The current {node}.nide node identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'cid' => array(
'description' => 'The current {comments}.cid comment identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'did',
),
);
return $schema;
}
/**
* Installs the disqus export schema.
*/
function disqus_migrate_update_6100() {
drupal_install_schema('disqus_migrate');
return array();
}
/**
* Drops the export table, adds a more useful and multi-purpose table
*/
function disqus_migrate_update_6101() {
$schema['disqus_migrate'] = array(
'description' => 'Holds associations of Disqus comment IDs to Drupal Comment IDs.',
'fields' => array(
'did' => array(
'description' => 'The primary identifier for the Disqus comment.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'dtid' => array(
'description' => 'The Disqus thread ID that the comment belongs to.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'nid' => array(
'description' => 'The current {node}.nide node identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'cid' => array(
'description' => 'The current {comments}.cid comment identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
),
'primary key' => array(
'did',
),
);
$ret = array();
if (db_table_exists('disqus_migrate_export')) {
db_drop_table($ret, 'disqus_migrate_export');
}
if (!db_table_exists('disqus_migrate')) {
db_create_table($ret, 'disqus_migrate', $schema['disqus_migrate']);
}
return $ret;
}
Functions
Name | Description |
---|---|
disqus_migrate_install | Implementation of hook_install |
disqus_migrate_schema | Implementation of hook_schema(). |
disqus_migrate_uninstall | Implementation of hook_uninstall |
disqus_migrate_update_6100 | Installs the disqus export schema. |
disqus_migrate_update_6101 | Drops the export table, adds a more useful and multi-purpose table |