summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/external/storage.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2016-02-29 15:17:06 +0100
committerLukas Reschke <lukas@owncloud.com>2016-03-01 07:01:51 +0100
commit080a62231e6575d7963d5c251275cca741133d2f (patch)
tree955b68ce2c9ae76ccba6b3a14530491784f9934b /apps/files_sharing/lib/external/storage.php
parent52d217d77519ed95a18237b09a351f83a0ae7f47 (diff)
downloadnextcloud-server-080a62231e6575d7963d5c251275cca741133d2f.tar.gz
nextcloud-server-080a62231e6575d7963d5c251275cca741133d2f.zip
use ocs discover endpoint to test remote
Diffstat (limited to 'apps/files_sharing/lib/external/storage.php')
-rw-r--r--apps/files_sharing/lib/external/storage.php14
1 files changed, 10 insertions, 4 deletions
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