You are here

function filefield_paths_install in File (Field) Paths 7

Same name and namespace in other branches
  1. 8 filefield_paths.install \filefield_paths_install()
  2. 5 filefield_paths.install \filefield_paths_install()
  3. 6.2 filefield_paths.install \filefield_paths_install()
  4. 6 filefield_paths.install \filefield_paths_install()

Implements hook_install().

File

./filefield_paths.install, line 27
Install, update and uninstall functions for the File (Field) Paths module.

Code

function filefield_paths_install() {

  // Add origname field to {file_managed}, and populate with the current
  // filenames.
  db_add_field('file_managed', 'origname', array(
    'description' => 'Original name of the file with no path components. Used by the filefield_paths module.',
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
    'default' => '',
  ));
  db_update('file_managed')
    ->expression('origname', 'filename')
    ->execute();
}