public function onBeforeInit() { // Allow easy clearing of the cache in dev mode if (Director::isDev() && isset($_GET['socialfeedclearcache']) && $_GET['socialfeedclearcache'] == 1) { foreach (SocialFeedProvider::get() as $prov) { $prov->clearFeedCache(); } } }
/** * Gets the feed for each provider and updates the cache with it. */ public function run($request) { $providers = SocialFeedProvider::get(); $providers = $providers->toArray(); if ($providers) { foreach ($providers as $prov) { $this->log('Getting feed for #' . $prov->ID . ' (' . $prov->ClassName . ')'); $feed = $prov->getFeedUncached(); $prov->setFeedCache($feed); $this->log('Updated feed cache for #' . $prov->ID . ' (' . $prov->ClassName . ')'); } } else { $this->log('No SocialFeedProvider exist to be updated.'); } }