You are here

function fe_paths_install in File Entity Paths 7.2

Implements hook_install().

File

./fe_paths.install, line 168
Install, update and uninstall functions for the File Entity Paths module. @todo: Figure out, how should this work with Filefield Paths. Now, the filefield_paths has partial media + File Entity support

Code

function fe_paths_install() {

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

  // Set the weight to 1.
  db_update('system')
    ->fields(array(
    'weight' => 1,
  ))
    ->condition('type', 'module')
    ->condition('name', 'fe_paths')
    ->execute();
}