lingotek.install in Lingotek Translation 6
Same filename and directory in other branches
- 8 lingotek.install
- 8.2 lingotek.install
- 7.7 lingotek.install
- 7.2 lingotek.install
- 7.3 lingotek.install
- 7.4 lingotek.install
- 7.5 lingotek.install
- 7.6 lingotek.install
- 4.0.x lingotek.install
- 3.0.x lingotek.install
- 3.1.x lingotek.install
- 3.2.x lingotek.install
- 3.3.x lingotek.install
- 3.4.x lingotek.install
- 3.5.x lingotek.install
- 3.6.x lingotek.install
- 3.7.x lingotek.install
- 3.8.x lingotek.install
Installation for Lingotek Community Translation Module
File
lingotek.installView source
<?php
/**
* @file
* Installation for Lingotek Community Translation Module
*/
/*
* Install the Lingotek module
*/
function lingotek_install() {
drupal_install_schema('lingotek');
}
/*
* Uninstall the Lingotek module
*/
function lingotek_uninstall() {
drupal_uninstall_schema('lingotek');
variable_del('lingotek_login_id');
variable_del('lingotek_login_key');
variable_del('lingotek_url');
variable_del('lingotek_community');
variable_del('lingotek_project');
variable_del('lingotek_project');
variable_del('lingotek_vault');
variable_del('lingotek_vault');
variable_del('lingotek_neutral_language');
variable_del('lingotek_menu_overwrite');
variable_del('lingotek_use_lightbox');
variable_del('lingotek_phase_template');
variable_del('lingotek_publish_with_mt');
variable_del('lingotek_available_mt_options');
variable_del('lingotek_error_log');
}
/*
* Install the database schema for the Lingotek module
*/
function lingotek_schema() {
$schema['lingotek'] = array(
'description' => 'Table for storing node related data.',
'fields' => array(
'nid' => array(
'description' => 'The primary identifier for a node',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'lingokey' => array(
'description' => 'Key in key/value pairs',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'lingovalue' => array(
'description' => 'Value of the specified key',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array(
'nid',
'lingokey',
),
);
$schema['lingotek_mt_queue'] = array(
'description' => 'Table for storing a Machine Translation queue.',
'fields' => array(
'uid' => array(
'description' => 'The primary identifier for a user.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'nid' => array(
'description' => 'The primary identifier for a node.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'language' => array(
'description' => 'Language to machine translate',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'engine' => array(
'description' => 'Engine used to machine translate',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
);
return $schema;
}
/*
* Update
* 1. Create the mt-queue
* 2. delete the reference variable that was stored in lingotek_languages
*/
function lingotek_update_6200() {
variable_del('lingotek_languages');
$schema['lingotek_mt_queue'] = array(
'description' => 'Table for storing a Machine Translation queue.',
'fields' => array(
'uid' => array(
'description' => 'The primary identifier for a user.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'nid' => array(
'description' => 'The primary identifier for a node.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'language' => array(
'description' => 'Language to machine translate',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'engine' => array(
'description' => 'Engine used to machine translate',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
),
);
$ret = array();
db_create_table($ret, 'lingotek_mt_queue', $schema['lingotek_mt_queue']);
return $ret;
}
/*
* Update documents to using the new html embedded in xml structure utilizing CDATA
*/
function lingotek_update_6201() {
$result = db_query("SELECT n.nid FROM {lingotek} n WHERE n.lingokey = 'document_id'");
while ($row = db_fetch_object($result)) {
$node = node_load(array(
'nid' => $row->nid,
));
lingotek_node_update($node);
}
return array();
}