123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- <?php
- function wysiwyg_schema() {
- $schema['wysiwyg'] = array(
- 'description' => 'Stores Wysiwyg profiles.',
- 'fields' => array(
- 'format' => array(
- 'description' => 'The {filter_format}.format of the text format.',
- 'type' => 'varchar',
- 'length' => 255,
-
- 'not null' => TRUE,
- ),
- 'editor' => array(
- 'description' => 'Internal name of the editor attached to the text format.',
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'settings' => array(
- 'description' => 'Configuration settings for the editor.',
- 'type' => 'text',
- 'size' => 'normal',
- 'serialize' => TRUE,
- ),
- ),
- 'primary key' => array('format'),
- 'foreign keys' => array(
- 'format' => array(
- 'table' => 'filter_format',
- 'columns' => array('format' => 'format'),
- ),
- ),
- );
- $schema['wysiwyg_user'] = array(
- 'description' => 'Stores user preferences for wysiwyg profiles.',
- 'fields' => array(
- 'uid' => array(
- 'description' => 'The {users}.uid of the user.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'format' => array(
- 'description' => 'The {filter_format}.format of the text format.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- ),
- 'status' => array(
- 'description' => 'Boolean indicating whether the format is enabled by default.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- ),
- ),
- 'indexes' => array(
- 'uid' => array('uid'),
- 'format' => array('format'),
- ),
- 'foreign keys' => array(
- 'uid' => array(
- 'table' => 'users',
- 'columns' => array('uid' => 'uid'),
- ),
- 'format' => array(
- 'table' => 'filter_format',
- 'columns' => array('format' => 'format'),
- ),
- ),
- );
- return $schema;
- }
- function wysiwyg_enable() {
-
-
- module_disable(array(
- 'ckeditor',
- 'editarea',
- 'editonpro',
- 'editor',
- 'fckeditor',
- 'freerte',
- 'htmlarea',
- 'htmlbox',
- 'jwysiwyg',
- 'markitup',
- 'nicedit',
- 'openwysiwyg',
- 'pegoeditor',
- 'quicktext',
- 'tinymce',
- 'tinymce_autoconf',
- 'tinytinymce',
- 'whizzywig',
- 'widgeditor',
- 'wymeditor',
- 'xstandard',
- 'yui_editor',
- ));
- }
- function wysiwyg_update_dependencies() {
-
-
- $dependencies['wysiwyg'][7000] = array(
- 'filter' => 7010,
- );
- return $dependencies;
- }
- function _wysiwyg_install_get_formats() {
- $formats = array();
- $result = db_query("SELECT format, name FROM {filter_formats}");
- while ($format = db_fetch_object($result)) {
-
- $formats[$format->format] = $format->name;
-
- $result2 = db_query("SELECT module, delta FROM {filters} WHERE format = %d", $format->format);
- while ($filter = db_fetch_object($result2)) {
-
- if ($filter->module == 'php') {
- unset($formats[$format->format]);
- break;
- }
- }
- }
- return $formats;
- }
- function wysiwyg_update_6001() {
- $ret = array();
- if (db_table_exists('wysiwyg')) {
- return $ret;
- }
-
- db_create_table($ret, 'wysiwyg', array(
- 'fields' => array(
- 'format' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
- 'editor' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
- 'settings' => array('type' => 'text', 'size' => 'normal'),
- ),
- 'primary key' => array('format'),
- ));
-
- $formats = _wysiwyg_install_get_formats();
-
- $result = db_query("SELECT name, settings FROM {wysiwyg_profile}");
- while ($profile = db_fetch_object($result)) {
- $profile->settings = unserialize($profile->settings);
-
- $profile->editor = $profile->settings['editor'];
-
- unset($profile->settings['editor']);
- unset($profile->settings['old_name']);
- unset($profile->settings['name']);
- unset($profile->settings['rids']);
-
- break;
- }
- if ($profile) {
-
- foreach ($formats as $format => $name) {
-
-
-
- db_query("INSERT INTO {wysiwyg} (format, editor, settings) VALUES (%d, '%s', '%s')", $format, $profile->editor, serialize($profile->settings));
- $ret[] = array(
- 'success' => TRUE,
- 'query' => strtr('Wysiwyg profile %profile converted and associated with input format %format.', array('%profile' => check_plain($profile->name), '%format' => check_plain($name))),
- );
- }
- }
-
- db_drop_table($ret, 'wysiwyg_profile');
- db_drop_table($ret, 'wysiwyg_role');
- return $ret;
- }
- function wysiwyg_update_6200() {
- $ret = array();
-
- _drupal_flush_css_js();
- drupal_clear_css_cache();
- drupal_clear_js_cache();
-
- menu_rebuild();
-
- cache_clear_all();
- $ret[] = array(
- 'success' => TRUE,
- 'query' => 'Caches have been flushed.',
- );
- return $ret;
- }
- function wysiwyg_update_7000() {
- db_drop_primary_key('wysiwyg');
- db_change_field('wysiwyg', 'format', 'format', array(
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- ));
- db_add_primary_key('wysiwyg', array('format'));
- }
- function wysiwyg_update_7200() {
- if (!db_table_exists('wysiwyg_user')) {
- db_create_table('wysiwyg_user', array(
- 'description' => 'Stores user preferences for wysiwyg profiles.',
- 'fields' => array(
- 'uid' => array(
- 'description' => 'The {users}.uid of the user.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'format' => array(
- 'description' => 'The {filter_format}.format of the text format.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- ),
- 'status' => array(
- 'description' => 'Boolean indicating whether the format is enabled by default.',
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- ),
- ),
- 'indexes' => array(
- 'uid' => array('uid'),
- 'format' => array('format'),
- ),
- 'foreign keys' => array(
- 'uid' => array(
- 'table' => 'users',
- 'columns' => array('uid' => 'uid'),
- ),
- 'format' => array(
- 'table' => 'filter_format',
- 'columns' => array('format' => 'format'),
- ),
- ),
- ));
- }
- else {
- db_change_field('wysiwyg_user', 'format', 'format', array(
- 'description' => 'The {filter_format}.format of the text format.',
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => FALSE,
- ));
- }
- }
|