function mailhandler_update_6206 in Mailhandler 6.2
Updates mailbox type to new format.
Between 2.0-rc1 and 2.0, the keys for mailbox type (IMAP/POP) changed, but the existing mailboxes were not updated. Additionally, between 2.0 and 2.1, this option was changed to avoid further confusion.
File
- ./
mailhandler.install, line 354 - Install, update and uninstall functions for the Mailhandler module.
Code
function mailhandler_update_6206() {
$ret = array();
$result = db_query('SELECT * FROM {mailhandler_mailbox}');
while ($row = db_fetch_array($result)) {
$row['settings'] = unserialize($row['settings']);
switch ($row['settings']['imap']) {
case '0':
$row['settings']['type'] = 'pop3';
break;
case '1':
$row['settings']['type'] = 'imap';
break;
}
if (empty($row['settings']['domain'])) {
$row['settings']['type'] = 'local';
}
unset($row['settings']['imap']);
drupal_write_record('mailhandler_mailbox', $row, 'mid');
}
return $ret;
}