You are here

function mailhandler_update_6203 in Mailhandler 6.2

Update filter plugin names.

File

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

Code

function mailhandler_update_6203() {
  $ret = array();
  $result = db_query('SELECT * FROM {feeds_importer}');
  while ($row = db_fetch_array($result)) {
    $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');
    }
  }
  return $ret;
}