You are here

function file_admin_install in File admin 7

Implements hook_install().

Add fields to the file_managed table.

File

./file_admin.install, line 13
Installation file for file_admin module.

Code

function file_admin_install() {
  $table = 'file_managed';
  $file_admin_schema = array();
  file_admin_schema_alter($file_admin_schema);
  $fields = array_keys($file_admin_schema[$table]['fields']);
  $schema = drupal_get_schema($table, TRUE);
  foreach ($fields as $field) {
    if (!empty($schema['fields'][$field]) && !db_field_exists($table, $field)) {
      db_add_field($table, $field, $schema['fields'][$field]);
    }
  }
}