diff --git a/app/Http/Controllers/Dashboard/DashboardController.php b/app/Http/Controllers/Dashboard/DashboardController.php index dcb60c92..ca3fdb52 100644 --- a/app/Http/Controllers/Dashboard/DashboardController.php +++ b/app/Http/Controllers/Dashboard/DashboardController.php @@ -67,9 +67,11 @@ class DashboardController extends Controller $components = Component::orderBy('order')->get(); $incidents = $this->getIncidents(); $subscribers = $this->getSubscribers(); - $feed = $this->feed->entries(); - $entries = array_slice($feed->channel->item, 0, 5); + $entries = null; + if ($feed = $this->feed->entries()) { + $entries = array_slice($feed->channel->item, 0, 5); + } return View::make('dashboard.index') ->withPageTitle(trans('dashboard.dashboard')) diff --git a/app/Integrations/Feed.php b/app/Integrations/Feed.php index 9be9c474..e118076e 100644 --- a/app/Integrations/Feed.php +++ b/app/Integrations/Feed.php @@ -12,6 +12,7 @@ namespace CachetHQ\Cachet\Integrations; use GuzzleHttp\Client; +use Exception; use Illuminate\Contracts\Cache\Repository; /** @@ -63,12 +64,16 @@ class Feed */ public function entries() { - return $this->cache->remember('feeds', 2880, function () { - $xml = simplexml_load_string((new Client())->get($this->url, [ - 'headers' => ['Accept' => 'application/rss+xml', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/'.constant('CACHET_VERSION') : 'cachet'], - ])->getBody()->getContents(), null, LIBXML_NOCDATA); + return $this->cache->remember('feeds', 720, function () { + try { + $xml = simplexml_load_string((new Client())->get($this->url, [ + 'headers' => ['Accept' => 'application/rss+xml', 'User-Agent' => defined('CACHET_VERSION') ? 'cachet/'.constant('CACHET_VERSION') : 'cachet'], + ])->getBody()->getContents(), null, LIBXML_NOCDATA); - return json_decode(json_encode($xml)); + return json_decode(json_encode($xml)); + } catch (Exception $e) { + // Do nothing, this isn't critical. + } }); } } diff --git a/resources/views/dashboard/index.blade.php b/resources/views/dashboard/index.blade.php index cbc07663..6e449696 100644 --- a/resources/views/dashboard/index.blade.php +++ b/resources/views/dashboard/index.blade.php @@ -85,6 +85,7 @@ + @if($entries)