You are here

function media_update_7224 in D7 Media 7.3

Same name and namespace in other branches
  1. 7.4 media.install \media_update_7224()
  2. 7.2 media.install \media_update_7224()

Rename variables, removing variable namespace.

File

./media.install, line 1159
Install, update and uninstall functions for the Media module.

Code

function media_update_7224() {

  // Create an array of variables sans 'media' prefix.
  $variables = array(
    'wysiwyg_title',
    'wysiwyg_icon_title',
    'wysiwyg_default_view_mode',
    'wysiwyg_upload_directory',
    'wysiwyg_allowed_types',
    'wysiwyg_allowed_attributes',
    'wysiwyg_browser_plugins',
    'dialog_theme',
    'import_batch_size',
    'fromurl_supported_schemes',
    'icon_base_directory',
    'icon_set',
    'show_deprecated_view_modes',
  );
  foreach ($variables as $variable) {

    // Find the value of the old variable.
    $value = variable_get('media__' . $variable);

    // Port the value of the variable if it was set.
    if (!is_null($value)) {
      variable_set('media_' . $variable, $value);
    }

    // Remove the old variable.
    variable_del('media__' . $variable);
  }
}