You are here

function feeds_update_7213 in Feeds 7.2

Set cache class for Feeds HTTP cache.

File

./feeds.install, line 771
Schema definitions install/update/uninstall hooks.

Code

function feeds_update_7213() {

  // Check if Feeds is enabled first.
  if (!class_exists('FeedsHTTPCache') && !module_exists('feeds')) {
    throw new DrupalUpdateException('Please enable the Feeds module to perform this update.');
  }

  // Perform a registry rebuild so the system hopefully discovers the
  // FeedsHTTPCache class.
  if (!class_exists('FeedsHTTPCache') && function_exists('registry_rebuild')) {
    registry_rebuild();
  }

  // Abort when the FeedsHTTPCache class is not yet found to avoid fatal errors
  // in _cache_get_object().
  if (!class_exists('FeedsHTTPCache')) {
    throw new DrupalUpdateException('Setting the cache class for the cache_feeds_http bin failed because the FeedsHTTPCache class could not be found. Please rebuild the Drupal class registry and perform database updates again.');
  }

  // Activate our custom cache handler for the HTTP cache.
  variable_set('cache_class_cache_feeds_http', 'FeedsHTTPCache');
}