tft_archive.install in Taxonomy File Tree 7.2
Install logic.
File
modules/tft_archive/tft_archive.installView source
<?php
/**
* @file
* Install logic.
*/
/**
* Implements hook_install().
*/
function tft_archive_install() {
if (db_table_exists('tft_archive_restore_d6')) {
// We need to copy all the old settings to our own.
$result = db_select('tft_archive_restore_d6', 't')
->fields('t', array())
->execute();
while ($row = $result
->fetchAssoc()) {
unset($row['og_nid']);
db_insert('tft_archive_restore')
->fields($row)
->execute();
}
// We need to flag all existing archive folders as such.
$result = db_select('taxonomy_term_data', 't')
->fields('t', array(
'tid',
))
->condition('name', db_like(t("Archive")) . '%', 'LIKE')
->execute();
while ($row = $result
->fetchAssoc()) {
db_insert('tft_archive_tid')
->fields(array(
'tid' => $row['tid'],
'is_archive' => 1,
))
->execute();
}
}
}
/**
* Implements hook_schema().
*/
function tft_archive_schema() {
return array(
'tft_archive_tid' => array(
'description' => 'Flags which terms are archive folders.',
'fields' => array(
'tid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'is_archive' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
),
'tft_archive_restore' => array(
'description' => 'Logs previous element position before being archived',
'fields' => array(
'id' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'type' => array(
'type' => 'varchar',
'length' => 10,
),
'previous_parent_tid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
),
);
}
Functions
Name | Description |
---|---|
tft_archive_install | Implements hook_install(). |
tft_archive_schema | Implements hook_schema(). |