X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FDashlet%2FPage%2FBlog.php;h=5a8b9ac1ebe94e02468ea094e7cedc898d3f37bc;hb=aa31a7a02e13acfc02a1519de90017ebff06e42d;hp=1eb8025c7f8883a3efa680d0a39b1ce3bda06298;hpb=c1151e81db1f59bb5f79c64f6e4347203d4072bb;p=civicrm-core.git diff --git a/CRM/Dashlet/Page/Blog.php b/CRM/Dashlet/Page/Blog.php index 1eb8025c7f..5a8b9ac1eb 100644 --- a/CRM/Dashlet/Page/Blog.php +++ b/CRM/Dashlet/Page/Blog.php @@ -1,9 +1,9 @@ fetch()) { - $expire = time() - (60 * 60 * 24 * self::CACHE_DAYS); - // Refresh data after CACHE_DAYS - if (strtotime($cache->created_date) < $expire) { - $new_data = $this->getFeeds(); - // If fetching the new rss feed was successful, return it - // Otherwise use the old cached data - it's better than nothing - if ($new_data) { - return $new_data; - } + $value = Civi::cache('community_messages')->get('dashboard_newsfeed'); + + if (!$value) { + $value = $this->getFeeds(); + + if ($value) { + Civi::cache('community_messages')->set('dashboard_newsfeed', $value, (60 * 60 * 24 * self::CACHE_DAYS)); } - return unserialize($cache->data); } - return $this->getFeeds(); + + return $value; } /** - * Fetch all feeds & cache results. + * Fetch all feeds. * * @return array */ @@ -104,7 +98,6 @@ class CRM_Dashlet_Page_Blog extends CRM_Core_Page { return array(); } $feeds = $this->formatItems($newsFeed); - CRM_Core_BAO_Cache::setItem($feeds, 'dashboard', 'newsfeed'); return $feeds; }