From 683b76030ae467c250ee52ff521b715aea2df088 Mon Sep 17 00:00:00 2001 From: mattab Date: Thu, 26 Dec 2013 23:18:23 +1300 Subject: [PATCH] Catch exception so that Plugins+Themes listing page are still displayed even if server not connected to the internet. Fixes #4431 Thanks for the report! --- plugins/CorePluginsAdmin/Controller.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/CorePluginsAdmin/Controller.php b/plugins/CorePluginsAdmin/Controller.php index 9a732d3cc22..1d269193e6a 100644 --- a/plugins/CorePluginsAdmin/Controller.php +++ b/plugins/CorePluginsAdmin/Controller.php @@ -223,13 +223,17 @@ private function createPluginsOrThemesView($template, $themesOnly) $view->pluginNamesHavingSettings = $this->getPluginNamesHavingSettingsForCurrentUser(); $view->isMarketplaceEnabled = CorePluginsAdmin::isMarketplaceEnabled(); + $view->pluginsHavingUpdate = array(); + $view->marketplacePluginNames = array(); + if (CorePluginsAdmin::isMarketplaceEnabled()) { - $marketplace = new Marketplace(); - $view->marketplacePluginNames = $marketplace->getAvailablePluginNames($themesOnly); - $view->pluginsHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly); - } else { - $view->pluginsHavingUpdate = array(); - $view->marketplacePluginNames = array(); + try { + $marketplace = new Marketplace(); + $view->marketplacePluginNames = $marketplace->getAvailablePluginNames($themesOnly); + $view->pluginsHavingUpdate = $marketplace->getPluginsHavingUpdate($themesOnly); + } catch(Exception $e) { + // curl exec connection error (ie. server not connected to internet) + } } return $view;