mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-12 10:04:26 +02:00
OStatus support removed
This commit is contained in:
parent
eb066b258d
commit
e8a3be6820
87 changed files with 773 additions and 4383 deletions
|
@ -788,10 +788,8 @@ class Contact
|
|||
'url' => DI::baseUrl() . '/profile/' . $user['nickname'],
|
||||
'nurl' => Strings::normaliseLink(DI::baseUrl() . '/profile/' . $user['nickname']),
|
||||
'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3),
|
||||
'request' => DI::baseUrl() . '/dfrn_request/' . $user['nickname'],
|
||||
'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
|
||||
'poll' => DI::baseUrl() . '/dfrn_poll/' . $user['nickname'],
|
||||
'confirm' => DI::baseUrl() . '/dfrn_confirm/' . $user['nickname'],
|
||||
'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
|
||||
'poll' => DI::baseUrl() . '/feed/' . $user['nickname'],
|
||||
'name-date' => DateTimeFormat::utcNow(),
|
||||
'uri-date' => DateTimeFormat::utcNow(),
|
||||
'avatar-date' => DateTimeFormat::utcNow(),
|
||||
|
@ -873,10 +871,8 @@ class Contact
|
|||
'nurl' => Strings::normaliseLink($url),
|
||||
'uri-id' => ItemURI::getIdByURI($url),
|
||||
'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3),
|
||||
'request' => DI::baseUrl() . '/dfrn_request/' . $user['nickname'],
|
||||
'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
|
||||
'poll' => DI::baseUrl() . '/dfrn_poll/' . $user['nickname'],
|
||||
'confirm' => DI::baseUrl() . '/dfrn_confirm/' . $user['nickname'],
|
||||
'poll' => DI::baseUrl() . '/feed/' . $user['nickname'],
|
||||
];
|
||||
|
||||
$avatar = Photo::selectFirst(['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
|
||||
|
@ -2532,22 +2528,6 @@ class Contact
|
|||
}
|
||||
|
||||
self::update($fields, $condition);
|
||||
|
||||
// We mustn't set the update fields for OStatus contacts since they are updated in OnePoll
|
||||
$condition['network'] = Protocol::OSTATUS;
|
||||
|
||||
// If the contact failed, propagate the update fields to all contacts
|
||||
if (empty($fields['failed'])) {
|
||||
unset($fields['last-update']);
|
||||
unset($fields['success_update']);
|
||||
unset($fields['failure_update']);
|
||||
}
|
||||
|
||||
if (empty($fields)) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::update($fields, $condition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3065,11 +3045,6 @@ class Contact
|
|||
/**
|
||||
* Takes a $uid and a url/handle and adds a new contact
|
||||
*
|
||||
* Currently if the contact is DFRN, interactive needs to be true, to redirect to the
|
||||
* dfrn_request page.
|
||||
*
|
||||
* Otherwise this can be used to bulk add StatusNet contacts, Twitter contacts, etc.
|
||||
*
|
||||
* Returns an array
|
||||
* $return['success'] boolean true if successful
|
||||
* $return['message'] error text if success is false.
|
||||
|
@ -3170,35 +3145,24 @@ class Contact
|
|||
return $result;
|
||||
}
|
||||
|
||||
if ($protocol === Protocol::OSTATUS && DI::config()->get('system', 'ostatus_disabled')) {
|
||||
$result['message'] .= DI::l10n()->t('The profile address specified belongs to a network which has been disabled on this site.') . '<br />';
|
||||
$ret['notify'] = '';
|
||||
}
|
||||
|
||||
if (!$ret['notify']) {
|
||||
$result['message'] .= DI::l10n()->t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . '<br />';
|
||||
}
|
||||
|
||||
$writeable = ((($protocol === Protocol::OSTATUS) && ($ret['notify'])) ? 1 : 0);
|
||||
|
||||
$subhub = (($protocol === Protocol::OSTATUS) ? true : false);
|
||||
|
||||
$hidden = (($protocol === Protocol::MAIL) ? 1 : 0);
|
||||
$hidden = ($protocol === Protocol::MAIL);
|
||||
|
||||
$pending = false;
|
||||
if (($protocol == Protocol::ACTIVITYPUB) && isset($ret['manually-approve'])) {
|
||||
$pending = (bool)$ret['manually-approve'];
|
||||
}
|
||||
|
||||
if (in_array($protocol, [Protocol::MAIL, Protocol::DIASPORA, Protocol::ACTIVITYPUB])) {
|
||||
$writeable = 1;
|
||||
}
|
||||
$writeable = in_array($protocol, [Protocol::MAIL, Protocol::DIASPORA, Protocol::ACTIVITYPUB]);
|
||||
|
||||
if (DBA::isResult($contact)) {
|
||||
// update contact
|
||||
$new_relation = (in_array($contact['rel'], [self::FOLLOWER, self::FRIEND]) ? self::FRIEND : self::SHARING);
|
||||
|
||||
$fields = ['rel' => $new_relation, 'subhub' => $subhub, 'readonly' => false, 'network' => $ret['network']];
|
||||
$fields = ['rel' => $new_relation, 'readonly' => false, 'network' => $ret['network']];
|
||||
|
||||
if ($contact['pending'] && !empty($contact['hub-verify'])) {
|
||||
ActivityPub\Transmitter::sendContactAccept($contact['url'], $contact['hub-verify'], $uid);
|
||||
|
@ -3236,7 +3200,6 @@ class Contact
|
|||
'blocked' => 0,
|
||||
'readonly' => 0,
|
||||
'pending' => $pending,
|
||||
'subhub' => $subhub
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -3258,11 +3221,6 @@ class Contact
|
|||
// Update the avatar
|
||||
self::updateAvatar($contact_id, $ret['photo']);
|
||||
|
||||
// pull feed and consume it, which should subscribe to the hub.
|
||||
if ($contact['network'] == Protocol::OSTATUS) {
|
||||
Worker::add(Worker::PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
||||
}
|
||||
|
||||
if ($probed) {
|
||||
GServer::updateFromProbeArray($ret);
|
||||
self::updateFromProbeArray($contact_id, $ret);
|
||||
|
@ -3733,10 +3691,6 @@ class Contact
|
|||
$networks[] = Protocol::DIASPORA;
|
||||
}
|
||||
|
||||
if (!DI::config()->get('system', 'ostatus_disabled')) {
|
||||
$networks[] = Protocol::OSTATUS;
|
||||
}
|
||||
|
||||
$condition = [
|
||||
'network' => $networks,
|
||||
'server-failed' => false,
|
||||
|
|
|
@ -284,7 +284,7 @@ class Relation
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS])) {
|
||||
if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN])) {
|
||||
$apcontact = APContact::getByURL($url, false);
|
||||
if (empty($apcontact)) {
|
||||
Logger::info('No discovery - The contact does not seem to speak ActivityPub.', ['id' => $contact['id'], 'url' => $url, 'network' => $contact['network']]);
|
||||
|
@ -369,7 +369,6 @@ class Relation
|
|||
Logger::info('Collecting suggestions', ['uid' => $uid, 'cid' => $cid, 'start' => $start, 'limit' => $limit]);
|
||||
|
||||
$diaspora = DI::config()->get('system', 'diaspora_enabled') ? Protocol::DIASPORA : Protocol::ACTIVITYPUB;
|
||||
$ostatus = !DI::config()->get('system', 'ostatus_disabled') ? Protocol::OSTATUS : Protocol::ACTIVITYPUB;
|
||||
|
||||
// The query returns contacts where contacts interacted with whom the given user follows.
|
||||
// Contacts who already are in the user's contact table are ignored.
|
||||
|
@ -377,12 +376,12 @@ class Relation
|
|||
(SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ?)
|
||||
AND NOT `cid` IN (SELECT `id` FROM `contact` WHERE `uid` = ? AND `nurl` IN
|
||||
(SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?))) AND `id` = `cid`)
|
||||
AND NOT `hidden` AND `network` IN (?, ?, ?, ?)
|
||||
AND NOT `hidden` AND `network` IN (?, ?, ?)
|
||||
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
|
||||
$cid,
|
||||
0,
|
||||
$uid, Contact::FRIEND, Contact::SHARING,
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $ostatus, $uid
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid
|
||||
], [
|
||||
'order' => ['last-item' => true],
|
||||
'limit' => $totallimit,
|
||||
|
@ -408,10 +407,10 @@ class Relation
|
|||
(SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ?)
|
||||
AND NOT `cid` IN (SELECT `id` FROM `contact` WHERE `uid` = ? AND `nurl` IN
|
||||
(SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?))) AND `id` = `cid`)
|
||||
AND NOT `hidden` AND `network` IN (?, ?, ?, ?)
|
||||
AND NOT `hidden` AND `network` IN (?, ?, ?)
|
||||
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
|
||||
$cid, 0, $uid, Contact::FRIEND, Contact::SHARING,
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $ostatus, $uid],
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid],
|
||||
['order' => ['last-item' => true], 'limit' => $totallimit]
|
||||
);
|
||||
|
||||
|
@ -429,10 +428,10 @@ class Relation
|
|||
// The query returns contacts that follow the given user but aren't followed by that user.
|
||||
$results = DBA::select('contact', [],
|
||||
["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` = ?)
|
||||
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?, ?)
|
||||
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?)
|
||||
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
|
||||
$uid, Contact::FOLLOWER, 0,
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $ostatus, $uid],
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid],
|
||||
['order' => ['last-item' => true], 'limit' => $totallimit]
|
||||
);
|
||||
|
||||
|
@ -450,10 +449,10 @@ class Relation
|
|||
// The query returns any contact that isn't followed by that user.
|
||||
$results = DBA::select('contact', [],
|
||||
["NOT `nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?) AND `nurl` = `nurl`)
|
||||
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?, ?)
|
||||
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?)
|
||||
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
|
||||
$uid, Contact::FRIEND, Contact::SHARING, 0,
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $ostatus, $uid],
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid],
|
||||
['order' => ['last-item' => true], 'limit' => $totallimit]
|
||||
);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class Conversation
|
|||
const PARCEL_ACTIVITYPUB = 0;
|
||||
const PARCEL_DFRN = 1; // Deprecated
|
||||
const PARCEL_DIASPORA = 2;
|
||||
const PARCEL_SALMON = 3;
|
||||
const PARCEL_SALMON = 3; // @deprecated since version 2024.09
|
||||
const PARCEL_FEED = 4; // Deprecated
|
||||
const PARCEL_SPLIT_CONVERSATION = 6; // @deprecated since version 2022.09
|
||||
const PARCEL_LEGACY_DFRN = 7; // @deprecated since version 2021.09
|
||||
|
|
|
@ -2617,11 +2617,6 @@ class GServer
|
|||
return;
|
||||
}
|
||||
|
||||
// We don't want to mark a server as OStatus when it had been marked with any other protocol before
|
||||
if ($protocol == Post\DeliveryData::OSTATUS) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the server is marked as ActivityPub then we won't change it to anything different
|
||||
if ($old == Post\DeliveryData::ACTIVITYPUB) {
|
||||
return;
|
||||
|
|
|
@ -602,16 +602,6 @@ class Item
|
|||
Logger::notice('duplicated item with the same guid found.', $condition);
|
||||
return true;
|
||||
}
|
||||
} elseif ($item['network'] == Protocol::OSTATUS) {
|
||||
// Check for an existing post with the same content. There seems to be a problem with OStatus.
|
||||
$condition = [
|
||||
"`body` = ? AND `network` = ? AND `created` = ? AND `contact-id` = ? AND `uid` = ?",
|
||||
$item['body'], $item['network'], $item['created'], $item['contact-id'], $item['uid']
|
||||
];
|
||||
if (Post::exists($condition)) {
|
||||
Logger::notice('duplicated item with the same body found.', $item);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -705,13 +695,12 @@ class Item
|
|||
{
|
||||
if (empty($item['network']) || in_array($item['network'], Protocol::FEDERATED)) {
|
||||
$condition = [
|
||||
'`uri-id` = ? AND `uid` = ? AND `network` IN (?, ?, ?, ?)',
|
||||
'`uri-id` = ? AND `uid` = ? AND `network` IN (?, ?, ?)',
|
||||
$item['uri-id'],
|
||||
$item['uid'],
|
||||
Protocol::ACTIVITYPUB,
|
||||
Protocol::DIASPORA,
|
||||
Protocol::DFRN,
|
||||
Protocol::OSTATUS
|
||||
Protocol::DFRN
|
||||
];
|
||||
$existing = Post::selectFirst(['id', 'network'], $condition);
|
||||
if (DBA::isResult($existing)) {
|
||||
|
@ -908,7 +897,7 @@ class Item
|
|||
/*
|
||||
* Do we already have this item?
|
||||
* We have to check several networks since Friendica posts could be repeated
|
||||
* via OStatus (maybe Diaspora as well)
|
||||
* via Diaspora.
|
||||
*/
|
||||
$duplicate = self::getDuplicateID($item);
|
||||
if ($duplicate) {
|
||||
|
|
|
@ -29,7 +29,7 @@ class DeliveryData
|
|||
const DFRN = 2;
|
||||
const LEGACY_DFRN = 3; // @deprecated since version 2021.09
|
||||
const DIASPORA = 4;
|
||||
const OSTATUS = 5;
|
||||
const OSTATUS = 5; // @deprecated since version 2024.09
|
||||
const MAIL = 6;
|
||||
|
||||
/**
|
||||
|
@ -83,9 +83,6 @@ class DeliveryData
|
|||
case self::DIASPORA:
|
||||
$increments[] = "`diaspora` = `diaspora` + 1";
|
||||
break;
|
||||
case self::OSTATUS:
|
||||
$increments[] = "`ostatus` = `ostatus` + 1";
|
||||
break;
|
||||
}
|
||||
|
||||
return DBA::update('post-delivery-data', $increments, ['uri-id' => $uri_id]);
|
||||
|
|
|
@ -30,8 +30,8 @@ class Engagement
|
|||
const ALTERNATIVES = ['source:news' => 'source:service', 'source:relay' => 'source:application',
|
||||
'media:picture' => 'media:image', 'media:photo' => 'media:image',
|
||||
'network:activitypub' => 'network:apub', 'network:friendica' => 'network:dfrn',
|
||||
'network:diaspora' => 'network:dspr', 'network:ostatus' => 'network:stat',
|
||||
'network:discourse' => 'network:dscs', 'network:tumblr' => 'network:tmbl', 'network:bluesky' => 'network:bsky'];
|
||||
'network:diaspora' => 'network:dspr', 'network:discourse' => 'network:dscs',
|
||||
'network:tumblr' => 'network:tmbl', 'network:bluesky' => 'network:bsky'];
|
||||
const MEDIA_NONE = 0;
|
||||
const MEDIA_IMAGE = 1;
|
||||
const MEDIA_VIDEO = 2;
|
||||
|
|
|
@ -1,174 +0,0 @@
|
|||
<?php
|
||||
|
||||
// Copyright (C) 2010-2024, the Friendica project
|
||||
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
|
||||
class PushSubscriber
|
||||
{
|
||||
/**
|
||||
* Send subscription notifications for the given user
|
||||
*
|
||||
* @param integer $uid User ID
|
||||
* @param int $default_priority
|
||||
* @return void
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function publishFeed(int $uid, int $default_priority = Worker::PRIORITY_HIGH)
|
||||
{
|
||||
$condition = ['push' => 0, 'uid' => $uid];
|
||||
DBA::update('push_subscriber', ['push' => 1, 'next_try' => DBA::NULL_DATETIME], $condition);
|
||||
|
||||
self::requeue($default_priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* start workers to transmit the feed data
|
||||
*
|
||||
* @param int $default_priority
|
||||
* @return void
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function requeue(int $default_priority = Worker::PRIORITY_HIGH)
|
||||
{
|
||||
// We'll push to each subscriber that has push > 0,
|
||||
// i.e. there has been an update (set in notifier.php).
|
||||
$subscribers = DBA::select('push_subscriber', ['id', 'push', 'callback_url', 'nickname'], ["`push` > 0 AND `next_try` < ?", DateTimeFormat::utcNow()]);
|
||||
|
||||
while ($subscriber = DBA::fetch($subscribers)) {
|
||||
// We always handle retries with low priority
|
||||
if ($subscriber['push'] > 1) {
|
||||
$priority = Worker::PRIORITY_LOW;
|
||||
} else {
|
||||
$priority = $default_priority;
|
||||
}
|
||||
|
||||
Logger::info('Publish feed to ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' with priority ' . $priority);
|
||||
Worker::add($priority, 'PubSubPublish', (int)$subscriber['id']);
|
||||
}
|
||||
|
||||
DBA::close($subscribers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renew the feed subscription
|
||||
*
|
||||
* @param integer $uid User ID
|
||||
* @param string $nick Priority for push workers
|
||||
* @param integer $subscribe Subscribe (Unsubscribe = false)
|
||||
* @param string $hub_callback Callback address
|
||||
* @param string $hub_topic Feed topic
|
||||
* @param string $hub_secret Subscription secret
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function renew(int $uid, string $nick, int $subscribe, string $hub_callback, string $hub_topic, string $hub_secret)
|
||||
{
|
||||
// fetch the old subscription if it exists
|
||||
$subscriber = DBA::selectFirst('push_subscriber', ['last_update', 'push'], ['callback_url' => $hub_callback]);
|
||||
|
||||
// delete old subscription if it exists
|
||||
DBA::delete('push_subscriber', ['callback_url' => $hub_callback]);
|
||||
|
||||
if ($subscribe) {
|
||||
// if we are just updating an old subscription, keep the
|
||||
// old values for last_update but reset the push
|
||||
if (DBA::isResult($subscriber)) {
|
||||
$last_update = $subscriber['last_update'];
|
||||
$push_flag = min($subscriber['push'], 1);
|
||||
} else {
|
||||
$last_update = DateTimeFormat::utcNow();
|
||||
$push_flag = 0;
|
||||
}
|
||||
|
||||
// subscribe means adding the row to the table
|
||||
$fields = ['uid' => $uid, 'callback_url' => $hub_callback,
|
||||
'topic' => $hub_topic, 'nickname' => $nick, 'push' => $push_flag,
|
||||
'last_update' => $last_update, 'renewed' => DateTimeFormat::utcNow(),
|
||||
'secret' => $hub_secret];
|
||||
DBA::insert('push_subscriber', $fields);
|
||||
|
||||
Logger::notice("Successfully subscribed [$hub_callback] for $nick");
|
||||
} else {
|
||||
Logger::notice("Successfully unsubscribed [$hub_callback] for $nick");
|
||||
// we do nothing here, since the row was already deleted
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delay the push subscriber
|
||||
*
|
||||
* @param integer $id Subscriber ID
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function delay(int $id)
|
||||
{
|
||||
$subscriber = DBA::selectFirst('push_subscriber', ['push', 'callback_url', 'renewed', 'nickname'], ['id' => $id]);
|
||||
if (!DBA::isResult($subscriber)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$retrial = $subscriber['push'];
|
||||
|
||||
if ($retrial > 14) {
|
||||
// End subscriptions if they weren't renewed for more than two months
|
||||
$days = round((time() - strtotime($subscriber['renewed'])) / (60 * 60 * 24));
|
||||
|
||||
if ($days > 60) {
|
||||
DBA::update('push_subscriber', ['push' => -1, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
|
||||
Logger::info('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.');
|
||||
} else {
|
||||
DBA::update('push_subscriber', ['push' => 0, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
|
||||
Logger::info('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.');
|
||||
}
|
||||
} else {
|
||||
// Calculate the delay until the next trial
|
||||
$delay = (($retrial + 3) ** 4) + (rand(1, 30) * ($retrial + 1));
|
||||
$next = DateTimeFormat::utc('now + ' . $delay . ' seconds');
|
||||
|
||||
$retrial = $retrial + 1;
|
||||
|
||||
DBA::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]);
|
||||
Logger::info('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the push subscriber
|
||||
*
|
||||
* @param integer $id Subscriber ID
|
||||
* @param string $last_update Date of last transmitted item
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function reset(int $id, string $last_update)
|
||||
{
|
||||
$subscriber = DBA::selectFirst('push_subscriber', ['callback_url', 'nickname'], ['id' => $id]);
|
||||
if (!DBA::isResult($subscriber)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// set last_update to the 'created' date of the last item, and reset push=0
|
||||
$fields = ['push' => 0, 'next_try' => DBA::NULL_DATETIME, 'last_update' => $last_update];
|
||||
DBA::update('push_subscriber', $fields, ['id' => $id]);
|
||||
Logger::info('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital');
|
||||
|
||||
$parts = parse_url($subscriber['callback_url']);
|
||||
unset($parts['path']);
|
||||
$server_url = (string)Uri::fromParts((array)$parts);
|
||||
$gsid = GServer::getID($server_url, true);
|
||||
if (!empty($gsid)) {
|
||||
GServer::setProtocol($gsid, Post\DeliveryData::OSTATUS);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -594,9 +594,9 @@ class Tag
|
|||
public static function countByTag(string $search, int $uid = 0): int
|
||||
{
|
||||
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
|
||||
AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
||||
AND (`network` IN (?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
||||
$search, 0, $uid,
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0,
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, $uid, 0,
|
||||
];
|
||||
|
||||
return DBA::count('tag-search-view', $condition);
|
||||
|
@ -615,9 +615,9 @@ class Tag
|
|||
public static function getURIIdListByTag(string $search, int $uid = 0, int $start = 0, int $limit = 100, int $last_uriid = 0): array
|
||||
{
|
||||
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
|
||||
AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
||||
AND (`network` IN (?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
||||
$search, 0, $uid,
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0,
|
||||
Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, $uid, 0,
|
||||
];
|
||||
|
||||
if (!empty($last_uriid)) {
|
||||
|
|
|
@ -152,8 +152,8 @@ class User
|
|||
}
|
||||
|
||||
$system['name'] = App::PLATFORM . " '" . App::CODENAME . "' " . App::VERSION . '-' . DB_UPDATE_VERSION;
|
||||
$system['sprvkey'] = $system['uprvkey'] = $system['prvkey'];
|
||||
$system['spubkey'] = $system['upubkey'] = $system['pubkey'];
|
||||
$system['uprvkey'] = $system['prvkey'];
|
||||
$system['upubkey'] = $system['pubkey'];
|
||||
$system['nickname'] = $system['nick'];
|
||||
$system['page-flags'] = self::PAGE_FLAGS_SOAPBOX;
|
||||
$system['account-type'] = $system['contact-type'];
|
||||
|
@ -183,8 +183,6 @@ class User
|
|||
'register_date' => $system['created'],
|
||||
'pubkey' => $system['pubkey'],
|
||||
'prvkey' => $system['prvkey'],
|
||||
'spubkey' => $system['spubkey'],
|
||||
'sprvkey' => $system['sprvkey'],
|
||||
'guid' => System::createUUID(),
|
||||
'verified' => true,
|
||||
'page-flags' => self::PAGE_FLAGS_SOAPBOX,
|
||||
|
@ -1315,11 +1313,6 @@ class User
|
|||
$prvkey = $keys['prvkey'];
|
||||
$pubkey = $keys['pubkey'];
|
||||
|
||||
// Create another keypair for signing/verifying salmon protocol messages.
|
||||
$sres = Crypto::newKeypair(512);
|
||||
$sprvkey = $sres['prvkey'];
|
||||
$spubkey = $sres['pubkey'];
|
||||
|
||||
$insert_result = DBA::insert('user', [
|
||||
'guid' => System::createUUID(),
|
||||
'username' => $username,
|
||||
|
@ -1329,8 +1322,6 @@ class User
|
|||
'nickname' => $nickname,
|
||||
'pubkey' => $pubkey,
|
||||
'prvkey' => $prvkey,
|
||||
'spubkey' => $spubkey,
|
||||
'sprvkey' => $sprvkey,
|
||||
'verified' => $verified,
|
||||
'blocked' => $blocked,
|
||||
'language' => $language,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue