You are here

function mailhandler_update_7204 in Mailhandler 7.2

Update filter plugin names.

File

./mailhandler.install, line 168
Install, update and uninstall functions for the Mailhandler module.

Code

function mailhandler_update_7204() {
  $result = db_query('SELECT * FROM {feeds_importer}');
  while ($row = $result
    ->fetchAssoc()) {
    $row['config'] = unserialize($row['config']);
    if ($row['config']['fetcher']['plugin_key'] == 'MailhandlerFetcher') {
      $old_names = array(
        'all',
        'nodes',
        'comments',
      );
      $new_names = array(
        'MailhandlerFilters',
        'MailhandlerFiltersNodes',
        'MailhandlerFiltersComments',
      );
      $row['config']['fetcher']['config']['filter'] = str_replace($old_names, $new_names, $row['config']['fetcher']['config']['filter']);
      drupal_write_record('feeds_importer', $row, 'id');
    }
  }
}