If Cloudlog cannot access DXcluster.co.uk for dxcluster information error. fixes issue #103
这个提交包含在:
父节点
e39c1a11cc
当前提交
d995fd6cbe
共有 1 个文件被更改,包括 40 次插入 和 0 次删除
|
|
@ -4,6 +4,19 @@ class Dxcluster extends CI_Controller {
|
||||||
|
|
||||||
/* Controls the functions for interacting with the cluster */
|
/* Controls the functions for interacting with the cluster */
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
if (isDomainAvailible('http://www.dxcluster.co.uk')) {
|
||||||
|
// internet is available
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
show_error('DX Cluster isnt available without internet access', '500');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Loads default view */
|
/* Loads default view */
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
@ -73,4 +86,31 @@ class Dxcluster extends CI_Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDomainAvailible($domain)
|
||||||
|
{
|
||||||
|
//check, if a valid url is provided
|
||||||
|
if(!filter_var($domain, FILTER_VALIDATE_URL))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//initialize curl
|
||||||
|
$curlInit = curl_init($domain);
|
||||||
|
curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10);
|
||||||
|
curl_setopt($curlInit,CURLOPT_HEADER,true);
|
||||||
|
curl_setopt($curlInit,CURLOPT_NOBODY,true);
|
||||||
|
curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true);
|
||||||
|
|
||||||
|
//get answer
|
||||||
|
$response = curl_exec($curlInit);
|
||||||
|
|
||||||
|
curl_close($curlInit);
|
||||||
|
|
||||||
|
if ($response) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* End of file dxcluster.php */
|
/* End of file dxcluster.php */
|
||||||
正在加载…
在新工单中引用