You are here

function filter_update_7001 in Drupal 7

Break out "escape HTML filter" option to its own filter.

Related topics

File

modules/filter/filter.install, line 199
Install, update, and uninstall functions for the Filter module.

Code

function filter_update_7001() {
  $result = db_query("SELECT format FROM {filter_format}")
    ->fetchCol();
  $insert = db_insert('filters')
    ->fields(array(
    'format',
    'module',
    'delta',
    'weight',
  ));
  foreach ($result as $format_id) {

    // Deprecated constants FILTER_HTML_STRIP = 1 and FILTER_HTML_ESCAPE = 2.
    if (variable_get('filter_html_' . $format_id, 1) == 2) {
      $insert
        ->values(array(
        'format' => $format_id,
        'module' => 'filter',
        'delta' => 4,
        'weight' => 0,
      ));
    }
    variable_del('filter_html_' . $format_id);
  }
  $insert
    ->execute();
}