function mailhandler_update_6201 in Mailhandler 6.2
Make 'mail' field strictly alphanumeric, to work with Features
See also
File
- ./
mailhandler.install, line 236 - Install, update and uninstall functions for the Mailhandler module.
Code
function mailhandler_update_6201() {
$ret = array();
$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 = db_fetch_array($result)) {
$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 = db_fetch_array($result)) {
$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');
}
}
return $ret;
}