From 3668673d7b3f64a5aaa80f569856b88460d9a522 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 17 Mar 2017 12:47:26 +0100 Subject: Create a notification when the update server couldn't be reached for some days Signed-off-by: Joas Schilling --- lib/private/Updater/VersionCheck.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'lib/private/Updater/VersionCheck.php') diff --git a/lib/private/Updater/VersionCheck.php b/lib/private/Updater/VersionCheck.php index ae3840a7fa5..3518f40bd4f 100644 --- a/lib/private/Updater/VersionCheck.php +++ b/lib/private/Updater/VersionCheck.php @@ -82,7 +82,12 @@ class VersionCheck { $url = $updaterUrl . '?version=' . $versionString; $tmp = []; - $xml = $this->getUrlContent($url); + try { + $xml = $this->getUrlContent($url); + } catch (\Exception $e) { + return false; + } + if ($xml) { $loadEntities = libxml_disable_entity_loader(true); $data = @simplexml_load_string($xml); @@ -108,16 +113,13 @@ class VersionCheck { /** * @codeCoverageIgnore * @param string $url - * @return bool|resource|string + * @return resource|string + * @throws \Exception */ protected function getUrlContent($url) { - try { - $client = $this->clientService->newClient(); - $response = $client->get($url); - return $response->getBody(); - } catch (\Exception $e) { - return false; - } + $client = $this->clientService->newClient(); + $response = $client->get($url); + return $response->getBody(); } } -- cgit v1.2.3