Commit 0e035bfd authored by rooby's avatar rooby Committed by joseph.olstad

Issue #2841742 by rooby: Media WYSIWYG View Mode configuration lost after media_wysiwyg_update_7205

parent 62e374d4
......@@ -164,11 +164,35 @@ function media_wysiwyg_update_7204() {
function media_wysiwyg_update_7205() {
$schema = media_wysiwyg_schema();
// Create the new configuration tables.
if (!db_table_exists('media_restrict_wysiwyg')) {
db_create_table('media_restrict_wysiwyg', $schema['media_restrict_wysiwyg']);
db_create_table('media_view_mode_wysiwyg', $schema['media_view_mode_wysiwyg']);
// Migrate the configuration from the old variables into the new DB tables.
$types = file_type_load_all(TRUE);
foreach ($types as $type) {
$wysiwyg_restricted_view_modes = variable_get("media_wysiwyg_view_mode_{$type->type}_wysiwyg_restricted_view_modes", array());
foreach ($wysiwyg_restricted_view_modes as $wysiwyg_restricted_view_mode) {
'type' => $type->type,
'display' => $wysiwyg_restricted_view_mode,
$file_wysiwyg_view_mode = variable_get("media_wysiwyg_view_mode_{$type->type}_file_wysiwyg_view_mode", 'wysiwyg');
'type' => $type->type,
'view_mode' => $file_wysiwyg_view_mode,
// Remove old configuration variables.
db_delete('variable')->condition('name', "media_wysiwyg_view_mode_%", "LIKE")->execute();
// Disable and uninstall View Mode module.Since the view mode module is
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment