You are here

file_aliases.install in File Aliases 5

Same filename and directory in other branches
  1. 6 file_aliases.install
  2. 7 file_aliases.install

File

file_aliases.install
View source
<?php

/**
 * @file
 */

/**
 * Implementation of hook_install().
 */
function file_aliases_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("ALTER TABLE {filefield_paths} ADD COLUMN filealias mediumtext NOT NULL");
      break;
    case 'pgsql':
      db_add_column($ret = array(), 'filefield_paths', 'filealias', 'text', array(
        'not null' => TRUE,
        'default' => '',
      ));
      break;
  }
}

/**
 * Implementation of hook_uninstall().
 */
function file_aliases_uninstall() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
    case 'pgsql':
      db_query("ALTER TABLE {filefield_paths} DROP filealias");
      db_query("DELETE FROM {url_alias} WHERE src LIKE '%s'", 'filefield_paths/alias/%');
      break;
  }
}

Functions

Namesort descending Description
file_aliases_install Implementation of hook_install().
file_aliases_uninstall Implementation of hook_uninstall().