You are here

filetree.install in File Tree 7.2

Same filename and directory in other branches
  1. 7 filetree.install

File

filetree.install
View source
<?php

/**
 * Implements hook_install().
 */
function filetree_install() {
  drupal_set_message(t('File Tree has been installed. Before this does anything, File Tree needs to be added to one or more text formats. Visit the <a href="!url">text format administration</a> to set up this filter.', array(
    '!url' => url('admin/config/content/formats'),
  )), 'warning');
}

/**
 * Upgrade File Tree to Drupal 7.
 */
function filetree_update_7000() {
  $result = db_select('d6_upgrade_filter')
    ->fields('d6_upgrade_filter')
    ->condition('module', 'filetree')
    ->execute();
  while ($instance = $result
    ->fetchObject()) {
    if ($format = filter_format_load($instance->format)) {
      $format->filters = array();
      foreach (filter_list_format($instance->format) as $filter_name => $filter) {
        $format->filters[$filter_name] = (array) $filter;
      }
      $format->filters['filetree'] = array(
        'weight' => $instance->weight,
        'status' => 1,
        'settings' => array(
          'folders' => variable_get('filetree_folders_' . $instance->format, '*'),
        ),
      );
      filter_format_save($format);
      variable_del('filetree_folders_' . $instance->format);
    }
  }
}

Functions

Namesort descending Description
filetree_install Implements hook_install().
filetree_update_7000 Upgrade File Tree to Drupal 7.