= 1) { // Import TinyMCE settings. db_query('INSERT INTO {wysiwyg_profile} (name, settings) SELECT name, settings FROM {tinymce_settings}'); // Import TinyMCE profile role associations. db_query('INSERT INTO {wysiwyg_role} (name, rid) SELECT name, rid FROM {tinymce_role}'); // Migrate profile configurations. // Convert buttons/plugins into an associative array and fix plugin count. $profiles = db_query("SELECT name, settings, plugin_count FROM {wysiwyg_profile}"); while ($profile = db_fetch_array($profiles)) { $settings = unserialize($profile['settings']); if (isset($settings['form_id'])) { $old_buttons = (isset($settings['buttons']) ? $settings['buttons'] : array()); $settings['buttons'] = array(); $plugin_count = 0; foreach ($old_buttons as $old_button => $enabled) { list($plugin, $button) = explode('-', $old_button, 2); $settings['buttons'][$plugin][$button] = 1; $plugin_count++; } // We can't use update_sql() here because of curly braces in serialized // array. db_query("UPDATE {wysiwyg_profile} SET settings = '%s', plugin_count = %d WHERE name = '%s'", serialize($settings), $plugin_count, $profile['name']); } } // Disable TinyMCE module. module_disable(array('tinymce')); drupal_set_message(t('TinyMCE module can be safely uninstalled now.')); } else { drupal_set_message(t('To migrate your existing TinyMCE settings to Wysiwyg Editor, please update TinyMCE module to the latest official release, and re-install Wysiwyg Editor module.')); } } }