From cd4ff72848cc93feb30f00af60977d8299493813 Mon Sep 17 00:00:00 2001 From: Alexander Turiak Date: Fri, 3 Aug 2012 23:42:24 +0300 Subject: [PATCH] Prevent dashboard from generating a bunch of reports when Google Charts API is unavailable --- .../controllers/DashboardController.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/code/core/Mage/Adminhtml/controllers/DashboardController.php b/app/code/core/Mage/Adminhtml/controllers/DashboardController.php index b5da784d369b8..06a76968a1f7a 100644 --- a/app/code/core/Mage/Adminhtml/controllers/DashboardController.php +++ b/app/code/core/Mage/Adminhtml/controllers/DashboardController.php @@ -95,16 +95,20 @@ public function tunnelAction() $newHash = Mage::helper('Mage_Adminhtml_Helper_Dashboard_Data')->getChartDataHash($gaData); if ($newHash == $gaHash) { if ($params = unserialize(base64_decode(urldecode($gaData)))) { - $response = $httpClient->setUri(Mage_Adminhtml_Block_Dashboard_Graph::API_URL) - ->setParameterGet($params) - ->setConfig(array('timeout' => 5)) - ->request('GET'); + try { + $response = $httpClient->setUri(Mage_Adminhtml_Block_Dashboard_Graph::API_URL) + ->setParameterGet($params) + ->setConfig(array('timeout' => 5)) + ->request('GET'); - $headers = $response->getHeaders(); + $headers = $response->getHeaders(); - $this->getResponse() - ->setHeader('Content-type', $headers['Content-type']) - ->setBody($response->getBody()); + $this->getResponse() + ->setHeader('Content-type', $headers['Content-type']) + ->setBody($response->getBody()); + } catch (Zend_Http_Client_Exception $e) { + Mage::logException($e); + } } } }