You are here

function mailhandler_update_6210 in Mailhandler 6.2

Moves authentication options to importer config.

File

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

Code

function mailhandler_update_6210() {
  $ret = array();
  $result = db_query('SELECT * FROM {feeds_source}');
  while ($row = db_fetch_array($result)) {
    $row['config'] = unserialize($row['config']);
    if (isset($row['config']['MailhandlerParser'])) {
      switch ($row['config']['MailhandlerParser']['if_auth_fails']) {
        case 'remove':
        case 'retry':
          $row['config']['MailhandlerParser']['auth_required'] = TRUE;
          break;
        case 'unpublish':
        case 'ignore':
          $row['config']['MailhandlerParser']['auth_required'] = FALSE;
          break;
      }
      unset($row['config']['MailhandlerParser']['if_auth_fails']);
      drupal_write_record('feeds_source', $row, array(
        'id',
        'feed_nid',
      ));
    }
  }
  return $ret;
}