}
$url=OC_OCSClient::getAppStoreURL().'/content/categories';
- $xml=@file_get_contents($url);
+ // set a sensible timeout of 10 sec to stay responsive even if the server is down.
+ $ctx = stream_context_create(
+ array(
+ 'http' => array(
+ 'timeout' => 10
+ )
+ )
+ );
+ $xml=@file_get_contents($url, 0, $ctx);
if($xml==FALSE) {
return NULL;
}
$filterurl='&filter='.urlencode($filter);
$url=OC_OCSClient::getAppStoreURL().'/content/data?categories='.urlencode($categoriesstring).'&sortmode=new&page='.urlencode($page).'&pagesize=100'.$filterurl.$version;
$apps=array();
- $xml=@file_get_contents($url);
+
+ // set a sensible timeout of 10 sec to stay responsive even if the server is down.
+ $ctx = stream_context_create(
+ array(
+ 'http' => array(
+ 'timeout' => 10
+ )
+ )
+ );
+ $xml=@file_get_contents($url, 0, $ctx);
+
if($xml==FALSE) {
return NULL;
}
}
$url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id);
- $xml=@file_get_contents($url);
+ // set a sensible timeout of 10 sec to stay responsive even if the server is down.
+ $ctx = stream_context_create(
+ array(
+ 'http' => array(
+ 'timeout' => 10
+ )
+ )
+ );
+ $xml=@file_get_contents($url, 0, $ctx);
if($xml==FALSE) {
OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL);
return NULL;
}
$url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item);
- $xml=@file_get_contents($url);
+ // set a sensible timeout of 10 sec to stay responsive even if the server is down.
+ $ctx = stream_context_create(
+ array(
+ 'http' => array(
+ 'timeout' => 10
+ )
+ )
+ );
+ $xml=@file_get_contents($url, 0, $ctx);
+
if($xml==FALSE) {
OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL);
return NULL;
$url=OC_OCSClient::getKBURL().'/knowledgebase/data?type=150&page='.$p.'&pagesize='.$s.$searchcmd;
$kbe=array();
- $xml=@file_get_contents($url);
+
+ // set a sensible timeout of 10 sec to stay responsive even if the server is down.
+ $ctx = stream_context_create(
+ array(
+ 'http' => array(
+ 'timeout' => 10
+ )
+ )
+ );
+ $xml=@file_get_contents($url, 0, $ctx);
+
if($xml==FALSE) {
OC_Log::write('core','Unable to parse knowledgebase content',OC_Log::FATAL);
return NULL;