function mailhandler_update_7201 in Mailhandler 7.2
Make 'mail' field strictly alphanumeric, to work with Features.
See also
File
- ./
mailhandler.install, line 100 - Install, update and uninstall functions for the Mailhandler module.
Code
function mailhandler_update_7201() {
$result = db_query('SELECT * FROM {mailhandler_mailbox}');
ctools_include('cleanstring');
// For each mailbox, convert mail to alphanumeric, and move existing value into settings.
while ($row = $result
->fetchAssoc()) {
$row['settings'] = unserialize($row['settings']);
$row['settings']['mail'] = $row['mail'];
$row['mail'] = ctools_cleanstring($row['mail'], array(
'separator' => '_',
'lower case' => 'true',
));
drupal_write_record('mailhandler_mailbox', $row, 'mid');
}
$result = db_query('SELECT * FROM {feeds_source}');
// For existing feed sources, need to convert selected mailboxes to alphanumeric.
while ($row = $result
->fetchAssoc()) {
$row['config'] = unserialize($row['config']);
if (isset($row['config']['MailhandlerFetcher']['mailbox'])) {
$row['config']['MailhandlerFetcher']['mailbox'] = ctools_cleanstring($row['config']['MailhandlerFetcher']['mailbox'], array(
'separator' => '_',
'lower case' => 'true',
));
drupal_write_record('feeds_source', $row, 'id');
}
}
}