fields('dup') ->condition('module', 'pathologic') ->execute(); while ($instance = $rez->fetchObject()) { // Load the format if ($format = filter_format_load($instance->format)) { // Load filters. $format->filters = array(); // Add the filters foreach (filter_list_format($instance->format) as $filter_name => $filter) { $format->filters[$filter_name] = (array)$filter; } // Add Pathologic $format->filters['pathologic'] = array( 'weight' => $instance->weight, 'status' => 1, 'settings' => array( 'absolute' => variable_get('filter_pathologic_absolute_' . $instance->format, TRUE), 'local_paths' => variable_get('filter_pathologic_local_paths_' . $instance->format, ''), ), ); // Save the format filter_format_save($format); // Unset old variables variable_del('filter_pathologic_absolute_' . $instance->format); variable_del('filter_pathologic_local_paths_' . $instance->format); } } // Delete Pathologic data from {d6_upgrade_filter}…? // No, maybe we don't want to actually do that…? } } /** * Convert obsolete "absolute" setting to modern "protocol_style" setting for * each filter instance. */ function pathologic_update_7200(&$sandbox) { foreach (filter_formats() as $format) { // @see http://drupal.org/node/1304930 if (empty($format->filters)) { $format->filters = array(); // Add the filters foreach (filter_list_format($format->format) as $filter_name => $filter) { $format->filters[$filter_name] = (array)$filter; } } if (isset($format->filters['pathologic'])) { $format->filters['pathologic']['settings']['protocol_style'] = $format->filters['pathologic']['settings']['absolute'] ? 'full' : 'path'; unset($format->filters['pathologic']['settings']['absolute']); filter_format_save($format); } } }