You are here

function mailhandler_update_7205 in Mailhandler 7.2

Enables the new Mailhandler PHP IMAP module.

Enables mailhandler_php_imap and makes it the default retrieval library for existing Mailhandler mailboxes.

File

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

Code

function mailhandler_update_7205() {
  if (!module_exists('mailhandler_php_imap')) {
    module_enable(array(
      'mailhandler_php_imap',
    ));
    $result = db_query('SELECT * FROM {mailhandler_mailbox}');
    while ($row = $result
      ->fetchAssoc()) {
      $row['settings'] = unserialize($row['settings']);
      $row['settings']['retrieve'] = 'MailhandlerPhpImapRetrieve';
      db_update('mailhandler_mailbox')
        ->fields(array(
        'settings' => serialize($row['settings']),
      ))
        ->condition('mid', $row['mid'])
        ->execute();
    }
  }
}