lib/private/OCS/DiscoveryService.php
/**
	 * Discover OCS end-points
	 *
	 * If no valid discovery data is found the defaults are returned
	 *
	 * @param string $remote
	 * @param string $service the service you want to discover
	 * @return array
	 */
Discover OCS end-points
If no valid discovery data is found the defaults are returned

@param string $remote
@param string $service the service you want to discover
@return array
Discover OCS end - points If no valid discovery data is found the defaults are returned @param string $remote @param string $service the service you want to discover @return array
public function discover($remote, $service) {
		$cacheData = $this->cache->get($remote . '#' . $service);
		if($cacheData) {
			return json_decode($cacheData, true);
		}
		$discoveredServices = [];
		try {
			$response = $this->client->get($remote . '/ocs-provider/', [
				'timeout' => 10,
				'connect_timeout' => 10,
			]);
			if($response->getStatusCode() === Http::STATUS_OK) {
				$decodedServices = json_decode($response->getBody(), true);
				$discoveredServices = $this->getEndpoints($decodedServices, $service);
			}
		} catch (\Exception $e) {
			return [];
		}
		$this->cache->set($remote . '#' . $service, json_encode($discoveredServices));
		return $discoveredServices;
	}
public function discover ( $ remote , $ service ) { $ cacheData = $ this -> cache -> get ( $ remote . '#' . $ service ) ; if ( $ cacheData ) { return json_decode ( $ cacheData , true ) ; } $ discoveredServices = [ ] ; try { $ response = $ this -> client -> get ( $ remote . '/ocs-provider/' , [ 'timeout' => 10 , 'connect_timeout' => 10 , ] ) ; if ( $ response -> getStatusCode ( ) === Http :: STATUS_OK ) { $ decodedServices = json_decode ( $ response -> getBody ( ) , true ) ; $ discoveredServices = $ this -> getEndpoints ( $ decodedServices , $ service ) ; } } catch ( \ Exception $ e ) { return [ ] ; } $ this -> cache -> set ( $ remote . '#' . $ service , json_encode ( $ discoveredServices ) ) ; return $ discoveredServices ; }
Discover OCS end-points
 If no valid discovery data is found the defaults are returned
Discover OCS end - points If no valid discovery data is found the defaults are returned
// Check the cache first // query the remote server for available services // if we couldn't discover the service or any end-points we return a empty array // Write into cache