Better error handeling in testremote
This commit is contained in:
parent
361607c72d
commit
f2ebac5c76
|
@ -11,9 +11,13 @@ OCP\JSON::checkAppEnabled('files_sharing');
|
||||||
$remote = $_GET['remote'];
|
$remote = $_GET['remote'];
|
||||||
|
|
||||||
function testUrl($url) {
|
function testUrl($url) {
|
||||||
$result = file_get_contents($url);
|
try {
|
||||||
$data = json_decode($result);
|
$result = file_get_contents($url);
|
||||||
return is_object($data) and !empty($data->version);
|
$data = json_decode($result);
|
||||||
|
return is_object($data) and !empty($data->version);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testUrl('https://' . $remote . '/status.php')) {
|
if (testUrl('https://' . $remote . '/status.php')) {
|
||||||
|
|
Loading…
Reference in New Issue