You are here

function tft_archive_install in Taxonomy File Tree 7.2

Implements hook_install().

File

modules/tft_archive/tft_archive.install, line 11
Install logic.

Code

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();
    }
  }
}