You are here

function fckeditor_update_6200 in FCKeditor - WYSIWYG HTML editor 6.2

Update from 6.x-1.x to 6.x-2.x

Change storage of exclusion modes

File

./fckeditor.install, line 551

Code

function fckeditor_update_6200() {
  $ret = array();
  $result = db_query("SELECT * FROM {fckeditor_settings}");
  while ($data = db_fetch_object($result)) {
    if ($data->settings) {
      $settings = unserialize($data->settings);
      foreach (array(
        'simple_incl',
        'excl',
      ) as $var) {
        $paths = preg_split('/[\\s,]+/', $settings[$var . '_paths']);
        $ids = preg_split('/[\\s,]+/', $settings[$var . '_fields']);
        $final = array();
        foreach ($paths as $path) {
          $path = trim($path);
          if (!empty($path)) {
            $final[] = $path . '.*';
          }
        }
        foreach ($ids as $id) {
          $id = trim($id);
          if (!empty($id)) {
            $final[] = '*.' . $id;
          }
        }
        $settings[$var] = implode("\n", $final);
        unset($settings[$var . '_paths'], $settings[$var . '_fields']);
      }
      db_query("UPDATE {fckeditor_settings} SET settings='%s' WHERE name='%s'", serialize($settings), $data->name);
      module_load_include('inc', 'fckeditor', 'fckeditor.admin');
      fckeditor_rebuild_selectors();
    }
  }
  return $ret;
}