New constant for federated protocols

This commit is contained in:
Michael 2019-07-01 18:00:55 +00:00
parent 4bb7a8c342
commit 6041f74df6
14 changed files with 29 additions and 27 deletions

View file

@ -963,7 +963,7 @@ class Contact extends BaseObject
}
if ((empty($profile["addr"]) || empty($profile["name"])) && (defaults($profile, "gid", 0) != 0)
&& in_array($profile["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])
&& in_array($profile["network"], Protocol::FEDERATED)
) {
Worker::add(PRIORITY_LOW, "UpdateGContact", $profile["gid"]);
}
@ -1587,7 +1587,7 @@ class Contact extends BaseObject
return '';
}
if (in_array($contact["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""])) {
if (in_array($contact["network"], array_merge(Protocol::FEDERATED ,['']))) {
$sql = "(`item`.`uid` = 0 OR (`item`.`uid` = ? AND NOT `item`.`global`))";
} else {
$sql = "`item`.`uid` = ?";
@ -1779,8 +1779,7 @@ class Contact extends BaseObject
self::markForArchival($contact);
}
$condition = ['self' => false, 'nurl' => Strings::normaliseLink($url),
'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]];
$condition = ['self' => false, 'nurl' => Strings::normaliseLink($url), 'network' => Protocol::FEDERATED];
// These contacts are sharing with us, we don't poll them.
// This means that we don't set the update fields in "OnePoll.php".
@ -1878,7 +1877,8 @@ class Contact extends BaseObject
self::updateContact($id, $uid, $ret['url'], $ret);
// Update the corresponding gcontact entry
PortableContact::lastUpdated($ret["url"]);
// PortableContact::lastUpdated($ret["url"]);
GContact::updateFromProbe($ret['url']);
return true;
}

View file

@ -177,7 +177,7 @@ class Item extends BaseObject
// We can always comment on posts from these networks
if (array_key_exists('writable', $row) &&
in_array($row['internal-network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
in_array($row['internal-network'], Protocol::FEDERATED)) {
$row['writable'] = true;
}
@ -1354,7 +1354,7 @@ class Item extends BaseObject
* We have to check several networks since Friendica posts could be repeated
* via OStatus (maybe Diasporsa as well)
*/
if (in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DIASPORA, Protocol::DFRN, Protocol::OSTATUS, ""])) {
if (in_array($item['network'], array_merge(Protocol::FEDERATED ,['']))) {
$condition = ["`uri` = ? AND `uid` = ? AND `network` IN (?, ?, ?)",
trim($item['uri']), $item['uid'],
Protocol::DIASPORA, Protocol::DFRN, Protocol::OSTATUS];
@ -2077,7 +2077,7 @@ class Item extends BaseObject
// Only distribute public items from native networks
$condition = ['id' => $itemid, 'uid' => 0,
'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""],
'network' => array_merge(Protocol::FEDERATED ,['']),
'visible' => true, 'deleted' => false, 'moderated' => false, 'private' => false];
$item = self::selectFirst(self::ITEM_FIELDLIST, $condition);
if (!DBA::isResult($item)) {
@ -2233,7 +2233,7 @@ class Item extends BaseObject
}
// is it an entry from a connector? Only add an entry for natively connected networks
if (!in_array($item["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, ""])) {
if (!in_array($item["network"], array_merge(Protocol::FEDERATED ,['']))) {
return;
}

View file

@ -471,7 +471,7 @@ class Profile
'pending' => false,
'hidden' => false,
'archive' => false,
'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA],
'network' => Protocol::FEDERATED,
]);
}
}