1.20.x file.install file_update_1004()

Convert file_entity variables to config.

File

modules/file/file.install, line 869
Install, update and uninstall functions for File module.

Code

function file_update_1004() {

  // Convert variables to config.
  $config = config('file.settings');
  $config->set('max_filesize', update_variable_get('file_entity_max_filesize', ''));
  $config->set('default_allowed_extensions', update_variable_get('file_entity_default_allowed_extensions', 'jpg jpeg gif png txt doc docx xls xlsx pdf ppt pptx pps ppsx odt ods odp mp3 mov mp4 m4a m4v mpeg avi ogg oga ogv weba webp webm'));
  $config->set('default_file_directory', update_variable_get('file_entity_default_file_directory', ''));
  $config->set('allow_insecure_download', update_variable_get('file_entity_allow_insecure_download', FALSE));
  $config->set('file_upload_wizard_skip_file_type', update_variable_get('file_entity_file_upload_wizard_skip_file_type', FALSE));
  $config->set('file_upload_wizard_skip_scheme', update_variable_get('file_entity_file_upload_wizard_skip_scheme', FALSE));
  $config->set('file_upload_wizard_skip_fields', update_variable_get('file_entity_file_upload_wizard_skip_fields', FALSE));
  $config->set('protect_repeated_render', update_variable_get('file_entity_protect_repeated_render', TRUE));
  $config->save();

  // Remove converted variables.
  update_variable_del('file_entity_max_filesize');
  update_variable_del('file_entity_default_allowed_extensions');
  update_variable_del('file_entity_default_file_directory');
  update_variable_del('file_entity_allow_insecure_download');
  update_variable_del('file_entity_file_upload_wizard_skip_file_type');
  update_variable_del('file_entity_file_upload_wizard_skip_scheme');
  update_variable_del('file_entity_file_upload_wizard_skip_fields');
  update_variable_del('file_entity_protect_repeated_render');

  // Delete unused variables.
  update_variable_del('file_entity_alt');
  update_variable_del('file_entity_title');
}