You are here

function feedapi_update_6104 in FeedAPI 6

Check out if the built-in content-type has an enabled parser.

File

./feedapi.install, line 164
Install file for FeedAPI module.

Code

function feedapi_update_6104() {
  $default_processor = 'feed';

  // Determine if the installation is affected
  $affected = FALSE;
  $settings = variable_get('feedapi_settings_' . $default_processor, FALSE);
  if (!isset($settings['parsers'])) {
    $affected = TRUE;
  }
  else {
    foreach ($settings['parsers'] as $parser => $setting) {
      if (!module_exists($parser) && $setting['enabled']) {
        $affected = TRUE;
      }
    }
  }
  if ($affected) {

    // Set the parser of defaultly shipped processors if it's not done previously
    $parsers = module_implements('feedapi_feed');
    if (count($parsers) > 0) {
      $set_processor = array(
        "parsers" => array(
          array_pop($parsers) => array(
            "enabled" => TRUE,
            "weight" => 0,
          ),
        ),
      );
      $settings = is_array($settings) ? array_merge($settings, $set_processor) : $set_processor;
      variable_set('feedapi_settings_' . $default_processor, $settings);
    }
  }
  return array();
}