Checks and sanitizes the aggregator configuration.
Goes through all fetchers, parsers and processors and checks whether they are available. If one is missing resets to standard configuration.
TRUE if this function resets the configuration; FALSE if not.
function aggregator_sanitize_configuration() {
$reset = FALSE;
list($fetcher, $parser, $processors) = _aggregator_get_variables();
if (!module_exists($fetcher)) {
$reset = TRUE;
}
if (!module_exists($parser)) {
$reset = TRUE;
}
foreach ($processors as $processor) {
if (!module_exists($processor)) {
$reset = TRUE;
break;
}
}
if ($reset) {
// Reset aggregator config if necessary using the module defaults.
config('aggregator.settings')
->set('fetcher', 'aggregator')
->set('parser', 'aggregator')
->set('processors', array(
'aggregator' => 'aggregator',
))
->save();
return TRUE;
}
return FALSE;
}