diff -r fcf75e232c5b -r 0ff3ba646492 web/drupal/modules/fckeditor/fckeditor.install --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/drupal/modules/fckeditor/fckeditor.install Fri Aug 21 16:26:26 2009 +0000 @@ -0,0 +1,309 @@ + 'Stores FCKeditor profile settings', + 'fields' => array( + 'name' => array( + 'type' => 'varchar', + 'not null' => TRUE, + 'default' => '', + 'length' => 128, + 'description' => 'Name of the FCKeditor profile', + ), + 'settings' => array( + 'type' => 'text', + 'description' => 'Profile settings', + ), + ), + 'primary key' => array('name'), + ); + $schema['fckeditor_role'] = array( + 'description' => 'Stores FCKeditor profile assignments', + 'fields' => array( + 'name' => array( + 'type' => 'varchar', + 'not null' => TRUE, + 'default' => '', + 'length' => 128, + 'description' => 'Name of the FCKeditor role', + ), + 'rid' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'description' => 'Drupal role id', + ), + ), + 'primary key' => array('name', 'rid'), + ); + + return $schema; +} + +/** + * Update from 6.x-1.0 to 6.x-1.1 + * + */ +function fckeditor_update_6110() { + $ret = array(); + + $result = db_query('SELECT * FROM {fckeditor_settings}'); + $global_profile_found = FALSE; + while ($data = db_fetch_object($result)) { + if ($data->name == "FCKeditor Global Profile") { + $global_profile_found = TRUE; + } + if ($data->settings) { + $settings = unserialize($data->settings); + } + if (isset($settings['excl_mode'], $settings['excl_list']) && !empty($settings['excl_list'])) { + switch ($settings['excl_mode']) { + case 0: + // normal exclusion based on the id + $settings['excl_fields'] = $settings['excl_list']; + $settings['excl_mode'] = 0; + break; + case 1: + //normal inclusion based on the id + $settings['excl_fields'] = $settings['excl_list']; + $settings['excl_mode'] = 1; + break; + case 2: + //path exclusion + $settings['excl_paths'] = $settings['excl_list']; + $settings['excl_mode'] = 0; + break; + case 3: + //path inclusion + $settings['excl_paths'] = $settings['excl_list']; + $settings['excl_mode'] = 1; + break; + } + unset($settings['excl_list']); + } + if (isset($settings['simple_incl_mode'], $settings['simple_incl_list']) && !empty($settings['simple_incl_list'])) { + switch ($settings['simple_incl_mode']) { + case 1: + //normal inclusion based on the id + $settings['simple_incl_fields'] = $settings['simple_incl_list']; + break; + case 3: + //path inclusion + $settings['simple_incl_paths'] = $settings['simple_incl_list']; + break; + } + unset($settings['simple_incl_mode']); + unset($settings['simple_incl_list']); + } + + db_query("UPDATE {fckeditor_settings} SET settings='%s' WHERE name='%s'", serialize($settings), $data->name); + } + + if (!$global_profile_found) { + db_query("INSERT INTO {fckeditor_settings} (name, settings) VALUES ('%s', '%s')", "FCKeditor Global Profile", serialize(array())); + } + return $ret; +} + +/** + * Update from 6.x-1.2 to 6.x-1.3 + * + */ +function fckeditor_update_6130() { + $ret = array(); + + $result = db_query("SELECT * FROM {fckeditor_settings} WHERE name <> 'FCKeditor Global Profile'"); + $hasimce = module_exists('imce'); + while (($data = db_fetch_object($result))) { + if ($data->settings) { + $settings = unserialize($data->settings); + + // Rewrite imce, upload_basic and upload_advanced settings to filebrowser and quickupload + $imce = ($hasimce && isset($settings['imce']) && $settings['imce'] == 't'); + $upload_basic = (isset($settings['upload_basic']) && $settings['upload_basic'] == 't'); + $upload_advanced = (isset($settings['upload_advanced']) && $settings['upload_advanced'] == 't'); + + if ($imce) { + $settings['filebrowser'] = 'imce'; + } + elseif ($upload_advanced) { + $settings['filebrowser'] = 'builtin'; + } + else { + $settings['filebrowser'] = 'none'; + } + + $settings['quickupload'] = $upload_basic ? 't' : 'f'; + + unset($settings['imce'], $settings['upload_basic'], $settings['upload_advanced']); + + // unfortunately, update_sql is not an option, as serialize($settings) will contain curly braces which will + // be replaced. update_sql does not support arguments like db_query() does. + + db_query("UPDATE {fckeditor_settings} SET settings='%s' WHERE name='%s'", serialize($settings), $data->name); + } + } + + return $ret; +} + +/** + * Implementation of hook_uninstall() + */ +function fckeditor_uninstall() { + drupal_uninstall_schema('fckeditor'); +}