You are here

function media_update_7225 in D7 Media 7.3

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

Migrate variables to appropriate submodules.

File

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

Code

function media_update_7225() {
  $data = array(
    'media_wysiwyg' => array(
      'wysiwyg_title',
      'wysiwyg_icon_title',
      'wysiwyg_default_view_mode',
      'wysiwyg_upload_directory',
      'wysiwyg_allowed_types',
      'wysiwyg_allowed_attributes',
      'wysiwyg_browser_plugins',
    ),
    'media_internet' => array(
      'fromurl_supported_schemes',
    ),
    'media_bulk_upload' => array(
      'import_batch_size',
    ),
  );
  foreach ($data as $module => $variables) {
    foreach ($variables as $variable) {

      // Only port variables to submodules if the submodule exists.
      if (module_exists($module)) {

        // 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($module . '_' . $variable, $value);
        }
      }

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