mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
fix ping_site()
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
require_once('include/zot.php');
|
||||
|
||||
require_once('include/hubloc.php');
|
||||
|
||||
class Checksites {
|
||||
|
||||
|
||||
@@ -288,30 +288,18 @@ function locations_by_netid($netid) {
|
||||
|
||||
function ping_site($url) {
|
||||
|
||||
$ret = array('success' => false);
|
||||
$ret = array('success' => false);
|
||||
|
||||
$sys = get_sys_channel();
|
||||
|
||||
$m = zot_build_packet($sys, 'ping');
|
||||
$r = zot_zot($url . '/post', $m);
|
||||
if(! $r['success']) {
|
||||
$ret['message'] = 'no answer from ' . $url;
|
||||
return $ret;
|
||||
}
|
||||
$packet_result = json_decode($r['body'], true);
|
||||
if(! $packet_result['success']) {
|
||||
$ret['message'] = 'packet failure from ' . $url;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if($packet_result['success']) {
|
||||
$ret['success'] = true;
|
||||
}
|
||||
else {
|
||||
$ret['message'] = 'unknown error from ' . $url;
|
||||
}
|
||||
$r = Zotlabs\Lib\Zotfinger::exec($url);
|
||||
|
||||
if(! $r['data']) {
|
||||
$ret['message'] = 'no answer from ' . $url;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$ret['success'] = true;
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user