Logger::info('Set failed status for new server', ['url' => $url]);
}
+ /**
+ * Remove unwanted content from the given URL
+ *
+ * @param string $url
+ * @return string cleaned URL
+ */
public static function cleanURL(string $url)
{
$url = trim($url, '/');
return Network::unparseURL($urlparts);
}
+ /**
+ * Return the base URL
+ *
+ * @param string $url
+ * @return string base URL
+ */
private static function getBaseURL(string $url)
{
- $urlparts = parse_url($url);
- unset($urlparts['user']);
- unset($urlparts['pass']);
- unset($urlparts['query']);
- unset($urlparts['fragment']);
+ $urlparts = parse_url(self::cleanURL($url));
unset($urlparts['path']);
return Network::unparseURL($urlparts);
}
}
}
- if (!empty($id) && ($serverdata['network'] != Protocol::PHANTOM)) {
+ if (!empty($serverdata['network']) && !empty($id) && ($serverdata['network'] != Protocol::PHANTOM)) {
$gcontacts = DBA::count('gcontact', ['gsid' => $id]);
$apcontacts = DBA::count('apcontact', ['gsid' => $id]);
$contacts = DBA::count('contact', ['uid' => 0, 'gsid' => $id]);