From 080a62231e6575d7963d5c251275cca741133d2f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 29 Feb 2016 15:17:06 +0100 Subject: use ocs discover endpoint to test remote --- apps/files_sharing/lib/external/storage.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'apps/files_sharing/lib/external') diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php index ba7fba654a9..7f54a955da2 100644 --- a/apps/files_sharing/lib/external/storage.php +++ b/apps/files_sharing/lib/external/storage.php @@ -218,20 +218,26 @@ class Storage extends DAV implements ISharedStorage { } /** - * check if the configured remote is a valid ownCloud instance + * check if the configured remote is a valid federated share provider * * @return bool */ protected function testRemote() { try { - $result = file_get_contents($this->remote . '/status.php'); - $data = json_decode($result); - return is_object($data) and !empty($data->version); + return $this->testRemoteUrl($this->remote . '/ocs-provider/index.php') + || $this->testRemoteUrl($this->remote . '/ocs-provider') + || $this->testRemoteUrl($this->remote . '/status.php'); } catch (\Exception $e) { return false; } } + private function testRemoteUrl($url) { + $result = file_get_contents($url); + $data = json_decode($result); + return (is_object($data) and !empty($data->version)); + } + /** * @return mixed * @throws ForbiddenException -- cgit v1.2.3