function mailhandler_update_6202 in Mailhandler 6.2
Adds new command plugins to existing Feeds importers.
Adds MailhandlerCommandsFiles and MailhandlerCommandsHeaders command plugins to existing Feeds importers.
See also
http://drupal.org/node/1147414
File
- ./
mailhandler.install, line 267 - Install, update and uninstall functions for the Mailhandler module.
Code
function mailhandler_update_6202() {
$ret = array();
$result = db_query('SELECT * FROM {feeds_importer}');
while ($row = db_fetch_array($result)) {
$row['config'] = unserialize($row['config']);
if ($row['config']['parser']['plugin_key'] == 'MailhandlerParser') {
$old_plugins = is_array($row['config']['parser']['config']['command_plugin']) ? $row['config']['parser']['config']['command_plugin'] : array();
$new_plugins = array(
'MailhandlerCommandsFiles' => 'MailhandlerCommandsFiles',
'MailhandlerCommandsHeaders' => 'MailhandlerCommandsHeaders',
);
$row['config']['parser']['config']['command_plugin'] = array_merge($old_plugins, $new_plugins);
drupal_write_record('feeds_importer', $row, 'id');
}
}
return $ret;
}