Stopped using deprecated constants NETWORK_* (#5537)

* Rewrite:
- stopped using deprecated NETWORK_* constants, now Protocol::* should be used
- still left them intact for slow/lazy developers ...

* Removed deprecated NETWORK_* constants as per code reviewer's request.
This commit is contained in:
Roland Häder 2018-08-11 22:40:44 +02:00 committed by Hypolite Petovan
parent c623465df2
commit e06fc2aa69
59 changed files with 527 additions and 492 deletions

View file

@ -7,6 +7,7 @@ namespace Friendica\Worker;
use Friendica\BaseObject;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -188,11 +189,11 @@ class Cron
AND `contact`.`network` IN ('%s', '%s', '%s', '%s', '%s') $sql_extra
AND NOT `contact`.`self` AND NOT `contact`.`blocked`
WHERE NOT `user`.`account_expired` AND NOT `user`.`account_removed` $abandon_sql",
DBA::escape(NETWORK_DFRN),
DBA::escape(NETWORK_OSTATUS),
DBA::escape(NETWORK_DIASPORA),
DBA::escape(NETWORK_FEED),
DBA::escape(NETWORK_MAIL)
DBA::escape(Protocol::DFRN),
DBA::escape(Protocol::OSTATUS),
DBA::escape(Protocol::DIASPORA),
DBA::escape(Protocol::FEED),
DBA::escape(Protocol::MAIL)
);
if (!DBA::isResult($contacts)) {
@ -206,11 +207,11 @@ class Cron
}
// Friendica and OStatus are checked once a day
if (in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS])) {
if (in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS])) {
$contact['priority'] = 2;
}
if ($contact['subhub'] && in_array($contact['network'], [NETWORK_DFRN, NETWORK_OSTATUS])) {
if ($contact['subhub'] && in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS])) {
/*
* We should be getting everything via a hub. But just to be sure, let's check once a day.
* (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
@ -222,7 +223,7 @@ class Cron
}
// Check Diaspora contacts or followers once a week
if (($contact["network"] == NETWORK_DIASPORA) || ($contact["rel"] == Contact::FOLLOWER)) {
if (($contact["network"] == Protocol::DIASPORA) || ($contact["rel"] == Contact::FOLLOWER)) {
$contact['priority'] = 4;
}
@ -277,7 +278,7 @@ class Cron
}
}
if (($contact['network'] == NETWORK_FEED) && ($contact['priority'] <= 3)) {
if (($contact['network'] == Protocol::FEED) && ($contact['priority'] <= 3)) {
$priority = PRIORITY_MEDIUM;
} elseif ($contact['archive']) {
$priority = PRIORITY_NEGLIGIBLE;

View file

@ -8,6 +8,7 @@ use Friendica\App;
use Friendica\BaseObject;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Database\PostUpdate;
use Friendica\Model\Contact;
@ -231,12 +232,12 @@ class CronJobs
$r = q("SELECT `id`, `url` FROM `contact`
WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
ORDER BY RAND() LIMIT 50", DBA::escape(NETWORK_DIASPORA));
ORDER BY RAND() LIMIT 50", DBA::escape(Protocol::DIASPORA));
if (!DBA::isResult($r)) {
return;
}
foreach ($r AS $contact) {
foreach ($r as $contact) {
// Quit the loop after 3 minutes
if (time() > ($starttime + 180)) {
return;
@ -247,7 +248,7 @@ class CronJobs
}
$data = Probe::uri($contact["url"]);
if ($data["network"] != NETWORK_DIASPORA) {
if ($data["network"] != Protocol::DIASPORA) {
continue;
}

View file

@ -7,6 +7,7 @@ namespace Friendica\Worker;
use Friendica\BaseObject;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -156,23 +157,23 @@ class Delivery extends BaseObject
// Transmit via Diaspora if the thread had started as Diaspora post
// This is done since the uri wouldn't match (Diaspora doesn't transmit it)
if (isset($parent) && ($parent['network'] == NETWORK_DIASPORA) && ($contact['network'] == NETWORK_DFRN)) {
$contact['network'] = NETWORK_DIASPORA;
if (isset($parent) && ($parent['network'] == Protocol::DIASPORA) && ($contact['network'] == Protocol::DFRN)) {
$contact['network'] = Protocol::DIASPORA;
}
logger("Delivering " . $cmd . " followup=$followup - via network " . $contact['network']);
switch ($contact['network']) {
case NETWORK_DFRN:
case Protocol::DFRN:
self::deliverDFRN($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup);
break;
case NETWORK_DIASPORA:
case Protocol::DIASPORA:
self::deliverDiaspora($cmd, $contact, $owner, $items, $target_item, $public_message, $top_level, $followup);
break;
case NETWORK_OSTATUS:
case Protocol::OSTATUS:
// Do not send to otatus if we are not configured to send to public networks
if ($owner['prvnets']) {
break;
@ -185,7 +186,7 @@ class Delivery extends BaseObject
// This is done in "notifier.php" (See "url_recipients" and "push_notify")
break;
case NETWORK_MAIL:
case Protocol::MAIL:
self::deliverMail($cmd, $contact, $owner, $target_item);
break;
@ -316,7 +317,7 @@ class Delivery extends BaseObject
if ($deliver_status < 0) {
logger('Delivery failed: queuing message ' . $target_item["guid"] );
Queue::add($contact['id'], NETWORK_DFRN, $atom, false, $target_item['guid']);
Queue::add($contact['id'], Protocol::DFRN, $atom, false, $target_item['guid']);
}
if (($deliver_status >= 200) && ($deliver_status <= 299)) {

View file

@ -6,6 +6,7 @@ namespace Friendica\Worker;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\GContact;
@ -147,8 +148,8 @@ class DiscoverPoCo
WHERE `last_contact` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
`last_failure` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
`network` IN ('%s', '%s', '%s', '%s', '') ORDER BY rand()",
DBA::escape(NETWORK_DFRN), DBA::escape(NETWORK_DIASPORA),
DBA::escape(NETWORK_OSTATUS), DBA::escape(NETWORK_FEED));
DBA::escape(Protocol::DFRN), DBA::escape(Protocol::DIASPORA),
DBA::escape(Protocol::OSTATUS), DBA::escape(Protocol::FEED));
if (!$users) {
return;
@ -159,13 +160,13 @@ class DiscoverPoCo
$urlparts = parse_url($user["url"]);
if (!isset($urlparts["scheme"])) {
DBA::update('gcontact', ['network' => NETWORK_PHANTOM],
DBA::update('gcontact', ['network' => Protocol::PHANTOM],
['nurl' => normalise_link($user["url"])]);
continue;
}
if (in_array($urlparts["host"], ["twitter.com", "identi.ca"])) {
$networks = ["twitter.com" => NETWORK_TWITTER, "identi.ca" => NETWORK_PUMPIO];
$networks = ["twitter.com" => Protocol::TWITTER, "identi.ca" => Protocol::PUMPIO];
DBA::update('gcontact', ['network' => $networks[$urlparts["host"]]],
['nurl' => normalise_link($user["url"])]);
@ -182,7 +183,7 @@ class DiscoverPoCo
$server_url = $user["server_url"];
}
if ((($server_url == "") && ($user["network"] == NETWORK_FEED)) || $force_update || PortableContact::checkServer($server_url, $user["network"])) {
if ((($server_url == "") && ($user["network"] == Protocol::FEED)) || $force_update || PortableContact::checkServer($server_url, $user["network"])) {
logger('Check profile '.$user["url"]);
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "check_profile", $user["url"]);
@ -241,7 +242,7 @@ class DiscoverPoCo
}
$data = Probe::uri($jj->url);
if ($data["network"] == NETWORK_DFRN) {
if ($data["network"] == Protocol::DFRN) {
logger("Profile ".$jj->url." is reachable (".$search.")", LOGGER_DEBUG);
logger("Add profile ".$jj->url." to local directory (".$search.")", LOGGER_DEBUG);
@ -288,7 +289,7 @@ class DiscoverPoCo
/// @TODO find all those and convert to all lower-case which is a keyword then
foreach ($contacts->data AS $user) {
$contact = Probe::uri($user->site_address."/".$user->name);
if ($contact["network"] != NETWORK_PHANTOM) {
if ($contact["network"] != Protocol::PHANTOM) {
$contact["about"] = $user->description;
GContact::update($contact);
}

View file

@ -6,6 +6,7 @@
namespace Friendica\Worker;
use Friendica\Core\Cache;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\GContact;
use Friendica\Network\Probe;
@ -31,7 +32,7 @@ class GProbe {
$result = Cache::get("gprobe:".$urlparts["host"]);
if (!is_null($result)) {
if (in_array($result["network"], [NETWORK_FEED, NETWORK_PHANTOM])) {
if (in_array($result["network"], [Protocol::FEED, Protocol::PHANTOM])) {
logger("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG);
return;
}
@ -43,7 +44,7 @@ class GProbe {
Cache::set("gprobe:".$urlparts["host"], $arr);
}
if (!in_array($arr["network"], [NETWORK_FEED, NETWORK_PHANTOM])) {
if (!in_array($arr["network"], [Protocol::FEED, Protocol::PHANTOM])) {
GContact::update($arr);
}
@ -54,7 +55,7 @@ class GProbe {
}
if (DBA::isResult($r)) {
// Check for accessibility and do a poco discovery
if (PortableContact::lastUpdated($r[0]['url'], true) && ($r[0]["network"] == NETWORK_DFRN)) {
if (PortableContact::lastUpdated($r[0]['url'], true) && ($r[0]["network"] == Protocol::DFRN)) {
PortableContact::loadWorker(0, 0, $r[0]['id'], str_replace('/profile/', '/poco/', $r[0]['url']));
}
}

View file

@ -7,6 +7,7 @@ namespace Friendica\Worker;
use Friendica\BaseObject;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -103,7 +104,7 @@ class Notifier
$uid = $item_id;
$recipients_relocate = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND `network` IN ('%s', '%s')",
intval($uid), NETWORK_DFRN, NETWORK_DIASPORA);
intval($uid), Protocol::DFRN, Protocol::DIASPORA);
} else {
// find ancestors
$condition = ['id' => $item_id, 'visible' => true, 'moderated' => false];
@ -250,15 +251,15 @@ class Notifier
$target_item['deny_cid'].$target_item['deny_gid']) == 0))
$push_notify = true;
if (($thr_parent && ($thr_parent['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
if (($thr_parent && ($thr_parent['network'] == Protocol::OSTATUS)) || ($parent['network'] == Protocol::OSTATUS)) {
$push_notify = true;
if ($parent["network"] == NETWORK_OSTATUS) {
if ($parent["network"] == Protocol::OSTATUS) {
// Distribute the message to the DFRN contacts as if this wasn't a followup since OStatus can't relay comments
// Currently it is work at progress
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `network` = '%s' AND NOT `blocked` AND NOT `pending` AND NOT `archive`",
intval($uid),
DBA::escape(NETWORK_DFRN)
DBA::escape(Protocol::DFRN)
);
if (DBA::isResult($r)) {
foreach ($r as $rr) {
@ -336,7 +337,7 @@ class Notifier
// If the thread parent is OStatus then do some magic to distribute the messages.
// We have not only to look at the parent, since it could be a Friendica thread.
if (($thr_parent && ($thr_parent['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
if (($thr_parent && ($thr_parent['network'] == Protocol::OSTATUS)) || ($parent['network'] == Protocol::OSTATUS)) {
$diaspora_delivery = false;
logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent['author-id']." - Owner: ".$thr_parent['owner-id'], LOGGER_DEBUG);
@ -370,9 +371,9 @@ class Notifier
}
// It only makes sense to distribute answers to OStatus messages to Friendica and OStatus - but not Diaspora
$networks = [NETWORK_OSTATUS, NETWORK_DFRN];
$networks = [Protocol::OSTATUS, Protocol::DFRN];
} else {
$networks = [NETWORK_OSTATUS, NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_MAIL];
$networks = [Protocol::OSTATUS, Protocol::DFRN, Protocol::DIASPORA, Protocol::MAIL];
}
} else {
$public_message = false;
@ -385,7 +386,7 @@ class Notifier
&& intval($target_item['pubmail'])) {
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `network` = '%s'",
intval($uid),
DBA::escape(NETWORK_MAIL)
DBA::escape(Protocol::MAIL)
);
if (DBA::isResult($r)) {
foreach ($r as $rr) {
@ -440,7 +441,7 @@ class Notifier
$r1 = q("SELECT `batch`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`name`) AS `name`, ANY_VALUE(`network`) AS `network`
FROM `contact` WHERE `network` = '%s' AND `batch` != ''
AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch`",
DBA::escape(NETWORK_DIASPORA),
DBA::escape(Protocol::DIASPORA),
intval($owner['uid']),
intval(Contact::SHARING)
);
@ -455,7 +456,7 @@ class Notifier
}
}
$condition = ['network' => NETWORK_DFRN, 'uid' => $owner['uid'], 'blocked' => false,
$condition = ['network' => Protocol::DFRN, 'uid' => $owner['uid'], 'blocked' => false,
'pending' => false, 'archive' => false, 'rel' => [Contact::FOLLOWER, Contact::FRIEND]];
$r2 = DBA::toArray(DBA::select('contact', ['id', 'name', 'network'], $condition));
@ -469,7 +470,7 @@ class Notifier
// except for Diaspora batch jobs
// Don't deliver to folks who have already been delivered to
if (($rr['network'] !== NETWORK_DIASPORA) && (in_array($rr['id'], $conversants))) {
if (($rr['network'] !== Protocol::DIASPORA) && (in_array($rr['id'], $conversants))) {
logger('notifier: already delivered id=' . $rr['id']);
continue;
}

View file

@ -8,6 +8,7 @@ use Friendica\BaseObject;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
use Friendica\Model\Item;
@ -68,7 +69,7 @@ class OnePoll
}
// Diaspora users, archived users and followers are only checked if they still exist.
if ($contact['archive'] || ($contact["network"] == NETWORK_DIASPORA) || ($contact["rel"] == Contact::FOLLOWER)) {
if ($contact['archive'] || ($contact["network"] == Protocol::DIASPORA) || ($contact["rel"] == Contact::FOLLOWER)) {
$last_updated = PortableContact::lastUpdated($contact["url"], true);
$updated = DateTimeFormat::utcNow();
@ -114,7 +115,7 @@ class OnePoll
);
// Update the contact entry
if (($contact['network'] === NETWORK_OSTATUS) || ($contact['network'] === NETWORK_DIASPORA) || ($contact['network'] === NETWORK_DFRN)) {
if (($contact['network'] === Protocol::OSTATUS) || ($contact['network'] === Protocol::DIASPORA) || ($contact['network'] === Protocol::DFRN)) {
if (!PortableContact::reachable($contact['url'])) {
logger("Skipping probably dead contact ".$contact['url']);
@ -160,7 +161,7 @@ class OnePoll
logger("poll: ({$contact['network']}-{$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
if ($contact['network'] === NETWORK_DFRN) {
if ($contact['network'] === Protocol::DFRN) {
$idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
if (intval($contact['duplex']) && $contact['dfrn-id']) {
$idtosend = '0:' . $orig_id;
@ -289,9 +290,9 @@ class OnePoll
$xml = Network::post($contact['poll'], $postvars);
} elseif (($contact['network'] === NETWORK_OSTATUS)
|| ($contact['network'] === NETWORK_DIASPORA)
|| ($contact['network'] === NETWORK_FEED)) {
} elseif (($contact['network'] === Protocol::OSTATUS)
|| ($contact['network'] === Protocol::DIASPORA)
|| ($contact['network'] === Protocol::FEED)) {
// Upgrading DB fields from an older Friendica version
// Will only do this once per notify-enabled OStatus contact
@ -300,7 +301,7 @@ class OnePoll
$stat_writeable = ((($contact['notify']) && ($contact['rel'] == Contact::FOLLOWER || $contact['rel'] == Contact::FRIEND)) ? 1 : 0);
// Contacts from OStatus are always writable
if ($contact['network'] === NETWORK_OSTATUS) {
if ($contact['network'] === Protocol::OSTATUS) {
$stat_writeable = 1;
}
@ -330,7 +331,7 @@ class OnePoll
$xml = $ret['body'];
} elseif ($contact['network'] === NETWORK_MAIL) {
} elseif ($contact['network'] === Protocol::MAIL) {
logger("Mail: Fetching for ".$contact['addr'], LOGGER_DEBUG);
$mail_disabled = ((function_exists('imap_open') && (! Config::get('system', 'imap_disabled'))) ? 0 : 1);
@ -383,7 +384,7 @@ class OnePoll
$datarray = [];
$datarray['verb'] = ACTIVITY_POST;
$datarray['object-type'] = ACTIVITY_OBJ_NOTE;
$datarray['network'] = NETWORK_MAIL;
$datarray['network'] = Protocol::MAIL;
// $meta = Email::messageMeta($mbox, $msg_uid);
$datarray['uri'] = Email::msgid2iri(trim($meta->message_id, '<>'));
@ -472,7 +473,7 @@ class OnePoll
// If it seems to be a reply but a header couldn't be found take the last message with matching subject
if (empty($datarray['parent-uri']) && $reply) {
$condition = ['title' => $datarray['title'], 'uid' => importer_uid, 'network' => NETWORK_MAIL];
$condition = ['title' => $datarray['title'], 'uid' => importer_uid, 'network' => Protocol::MAIL];
$params = ['order' => ['created' => true]];
$parent = Item::selectFirst(['parent-uri'], $condition, $params);
if (DBA::isResult($parent)) {
@ -529,7 +530,7 @@ class OnePoll
if ($datarray['parent-uri'] === $datarray['uri']) {
$datarray['private'] = 1;
}
if (($contact['network'] === NETWORK_MAIL) && (!PConfig::get($importer_uid, 'system', 'allow_public_email_replies'))) {
if (($contact['network'] === Protocol::MAIL) && (!PConfig::get($importer_uid, 'system', 'allow_public_email_replies'))) {
$datarray['private'] = 1;
$datarray['allow_cid'] = '<' . $contact['id'] . '>';
}
@ -584,16 +585,16 @@ class OnePoll
consume_feed($xml, $importer, $contact, $hub);
// do it a second time for DFRN so that any children find their parents.
if ($contact['network'] === NETWORK_DFRN) {
if ($contact['network'] === Protocol::DFRN) {
consume_feed($xml, $importer, $contact, $hub);
}
$hubmode = 'subscribe';
if ($contact['network'] === NETWORK_DFRN || $contact['blocked']) {
if ($contact['network'] === Protocol::DFRN || $contact['blocked']) {
$hubmode = 'unsubscribe';
}
if (($contact['network'] === NETWORK_OSTATUS || $contact['network'] == NETWORK_FEED) && (! $contact['hub-verify'])) {
if (($contact['network'] === Protocol::OSTATUS || $contact['network'] == Protocol::FEED) && (! $contact['hub-verify'])) {
$hub_update = true;
}
@ -603,7 +604,7 @@ class OnePoll
logger("Contact ".$contact['id']." returned hub: ".$hub." Network: ".$contact['network']." Relation: ".$contact['rel']." Update: ".$hub_update);
if (strlen($hub) && $hub_update && (($contact['rel'] != Contact::FOLLOWER) || $contact['network'] == NETWORK_FEED)) {
if (strlen($hub) && $hub_update && (($contact['rel'] != Contact::FOLLOWER) || $contact['network'] == Protocol::FEED)) {
logger('hub ' . $hubmode . ' : ' . $hub . ' contact name : ' . $contact['name'] . ' local user : ' . $importer['name']);
$hubs = explode(',', $hub);
if (count($hubs)) {
@ -622,7 +623,7 @@ class OnePoll
self::updateContact($contact, ['last-update' => $updated, 'success_update' => $updated]);
DBA::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
Contact::unmarkForArchival($contact);
} elseif (in_array($contact["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_FEED])) {
} elseif (in_array($contact["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, Protocol::FEED])) {
$updated = DateTimeFormat::utcNow();
self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);

View file

@ -7,6 +7,7 @@ namespace Friendica\Worker;
use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Contact;
@ -110,7 +111,7 @@ class Queue
$deliver_status = 0;
switch ($contact['network']) {
case NETWORK_DFRN:
case Protocol::DFRN:
logger('queue: dfrndelivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
$deliver_status = DFRN::deliver($owner, $contact, $data);
@ -121,7 +122,8 @@ class Queue
Cache::set($cachekey_deadguy . $contact['notify'], true, CACHE_MINUTE);
}
break;
case NETWORK_OSTATUS:
case Protocol::OSTATUS:
logger('queue: slapdelivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
$deliver_status = Salmon::slapper($owner, $contact['notify'], $data);
@ -132,7 +134,8 @@ class Queue
QueueModel::removeItem($q_item['id']);
}
break;
case NETWORK_DIASPORA:
case Protocol::DIASPORA:
logger('queue: diaspora_delivery: item ' . $q_item['id'] . ' for ' . $contact['name'] . ' <' . $contact['url'] . '>');
$deliver_status = Diaspora::transmit($owner, $contact, $data, $public, true, 'Queue:' . $q_item['id'], true);

View file

@ -6,6 +6,7 @@
namespace Friendica\Worker;
use Friendica\Core\Protocol;
use Friendica\Database\DBA;
use Friendica\Network\Probe;
use Friendica\Protocol\PortableContact;
@ -28,13 +29,13 @@ class UpdateGContact
return;
}
if (!in_array($r[0]["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) {
if (!in_array($r[0]["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
return;
}
$data = Probe::uri($r[0]["url"]);
if (!in_array($data["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS])) {
if (!in_array($data["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
if ($r[0]["server_url"] != "") {
PortableContact::checkServer($r[0]["server_url"], $r[0]["network"]);
}