mirror of
https://github.com/friendica/friendica
synced 2025-04-23 10:30:11 +00:00
Merge remote-tracking branch 'upstream/develop' into unify-link
This commit is contained in:
commit
7c266be206
39 changed files with 537 additions and 315 deletions
|
@ -361,7 +361,7 @@ class Contact
|
|||
$background_update = DI::config()->get('system', 'update_active_contacts') ? $contact['local-data'] : true;
|
||||
|
||||
// Update the contact in the background if needed
|
||||
if ($background_update && !self::isLocal($url) && Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||
if ($background_update && !self::isLocal($url) && Protocol::supportsProbe($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||
try {
|
||||
UpdateContact::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], $contact['id']);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
|
@ -1279,7 +1279,7 @@ class Contact
|
|||
|
||||
$background_update = DI::config()->get('system', 'update_active_contacts') ? $contact['local-data'] : true;
|
||||
|
||||
if ($background_update && !self::isLocal($url) && Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||
if ($background_update && !self::isLocal($url) && Protocol::supportsProbe($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||
try {
|
||||
UpdateContact::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], $contact['id']);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
|
@ -2682,6 +2682,8 @@ class Contact
|
|||
return true;
|
||||
}
|
||||
|
||||
$has_local_data = self::hasLocalData($id, $contact);
|
||||
|
||||
$uid = $contact['uid'];
|
||||
unset($contact['uid']);
|
||||
|
||||
|
@ -2702,18 +2704,20 @@ class Contact
|
|||
|
||||
$updated = DateTimeFormat::utcNow();
|
||||
|
||||
$has_local_data = self::hasLocalData($id, $contact);
|
||||
|
||||
if (!Probe::isProbable($ret['network'])) {
|
||||
if (!Protocol::supportsProbe($ret['network']) && !Protocol::supportsProbe($contact['network'])) {
|
||||
// Periodical checks are only done on federated contacts
|
||||
$failed_next_update = null;
|
||||
$success_next_update = null;
|
||||
} elseif ($has_local_data) {
|
||||
$failed_next_update = GServer::getNextUpdateDate(false, $created, $last_update, !in_array($contact['network'], Protocol::FEDERATED));
|
||||
$success_next_update = GServer::getNextUpdateDate(true, $created, $last_update, !in_array($contact['network'], Protocol::FEDERATED));
|
||||
} else {
|
||||
} elseif (in_array($ret['network'], array_merge(Protocol::NATIVE_SUPPORT, [Protocol::ZOT, Protocol::PHANTOM]))) {
|
||||
$failed_next_update = DateTimeFormat::utc('now +6 month');
|
||||
$success_next_update = DateTimeFormat::utc('now +1 month');
|
||||
} else {
|
||||
// We don't check connector networks very often to not run into API rate limits
|
||||
$failed_next_update = DateTimeFormat::utc('now +12 month');
|
||||
$success_next_update = DateTimeFormat::utc('now +12 month');
|
||||
}
|
||||
|
||||
if (Strings::normaliseLink($contact['url']) != Strings::normaliseLink($ret['url'])) {
|
||||
|
@ -3596,7 +3600,7 @@ class Contact
|
|||
if (empty($contact['id']) && Network::isValidHttpUrl($url)) {
|
||||
Worker::add(Worker::PRIORITY_LOW, 'AddContact', 0, $url);
|
||||
++$added;
|
||||
} elseif (!empty($contact['network']) && Probe::isProbable($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||
} elseif (!empty($contact['network']) && Protocol::supportsProbe($contact['network']) && ($contact['next-update'] < DateTimeFormat::utcNow())) {
|
||||
try {
|
||||
UpdateContact::add(['priority' => Worker::PRIORITY_LOW, 'dont_fork' => true], $contact['id']);
|
||||
++$updated;
|
||||
|
|
|
@ -918,9 +918,7 @@ class Photo
|
|||
*/
|
||||
public static function getResourceData(string $name): array
|
||||
{
|
||||
$base = DI::baseUrl();
|
||||
|
||||
$guid = str_replace([Strings::normaliseLink($base), '/photo/'], '', Strings::normaliseLink($name));
|
||||
$guid = str_replace([Strings::normaliseLink((string)DI::baseUrl()), '/photo/'], '', Strings::normaliseLink($name));
|
||||
|
||||
if (parse_url($guid, PHP_URL_SCHEME)) {
|
||||
return [];
|
||||
|
@ -982,9 +980,7 @@ class Photo
|
|||
*/
|
||||
public static function isLocalPage(string $name): bool
|
||||
{
|
||||
$base = DI::baseUrl();
|
||||
|
||||
$guid = str_replace(Strings::normaliseLink($base), '', Strings::normaliseLink($name));
|
||||
$guid = str_replace(Strings::normaliseLink((string)DI::baseUrl()), '', Strings::normaliseLink($name));
|
||||
$guid = preg_replace("=/photos/.*/image/(.*)=ism", '$1', $guid);
|
||||
if (empty($guid)) {
|
||||
return false;
|
||||
|
|
|
@ -78,7 +78,7 @@ class Delivery
|
|||
*/
|
||||
public static function incrementFailed(int $uri_id, string $inbox)
|
||||
{
|
||||
return DBA::e('UPDATE `post-delivery` SET `failed` = `failed` + 1 WHERE `uri-id` = ? AND `inbox-id` = ?', $uri_id, ItemURI::getIdByURI($inbox));
|
||||
return DBA::update('post-delivery', ["`failed` = `failed` + 1"], ['uri-id' => $uri_id, 'inbox-id' => ItemURI::getIdByURI($inbox)]);
|
||||
}
|
||||
|
||||
public static function selectForInbox(string $inbox)
|
||||
|
|
|
@ -82,27 +82,27 @@ class DeliveryData
|
|||
*/
|
||||
public static function incrementQueueDone(int $uri_id, int $protocol = 0)
|
||||
{
|
||||
$sql = '';
|
||||
$increments = ["`queue_done` = `queue_done` + 1"];
|
||||
|
||||
switch ($protocol) {
|
||||
case self::ACTIVITYPUB:
|
||||
$sql = ", `activitypub` = `activitypub` + 1";
|
||||
$increments[] = "`activitypub` = `activitypub` + 1";
|
||||
break;
|
||||
case self::DFRN:
|
||||
$sql = ", `dfrn` = `dfrn` + 1";
|
||||
$increments[] = "`dfrn` = `dfrn` + 1";
|
||||
break;
|
||||
case self::LEGACY_DFRN:
|
||||
$sql = ", `legacy_dfrn` = `legacy_dfrn` + 1";
|
||||
$increments[] = "`legacy_dfrn` = `legacy_dfrn` + 1";
|
||||
break;
|
||||
case self::DIASPORA:
|
||||
$sql = ", `diaspora` = `diaspora` + 1";
|
||||
$increments[] = "`diaspora` = `diaspora` + 1";
|
||||
break;
|
||||
case self::OSTATUS:
|
||||
$sql = ", `ostatus` = `ostatus` + 1";
|
||||
$increments[] = "`ostatus` = `ostatus` + 1";
|
||||
break;
|
||||
}
|
||||
|
||||
return DBA::e('UPDATE `post-delivery-data` SET `queue_done` = `queue_done` + 1' . $sql . ' WHERE `uri-id` = ?', $uri_id);
|
||||
return DBA::update('post-delivery-data', $increments, ['uri-id' => $uri_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,7 +116,7 @@ class DeliveryData
|
|||
*/
|
||||
public static function incrementQueueFailed(int $uri_id)
|
||||
{
|
||||
return DBA::e('UPDATE `post-delivery-data` SET `queue_failed` = `queue_failed` + 1 WHERE `uri-id` = ?', $uri_id);
|
||||
return DBA::update('post-delivery-data', ["`queue_failed` = `queue_failed` + 1"], ['uri-id' => $uri_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,7 +129,7 @@ class DeliveryData
|
|||
*/
|
||||
public static function incrementQueueCount(int $uri_id, int $increment = 1)
|
||||
{
|
||||
return DBA::e('UPDATE `post-delivery-data` SET `queue_count` = `queue_count` + ? WHERE `uri-id` = ?', $increment, $uri_id);
|
||||
return DBA::update('post-delivery-data', ["`queue_count` = `queue_count` + $increment"], ['uri-id' => $uri_id]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -167,7 +167,7 @@ class User
|
|||
$system['region'] = '';
|
||||
$system['postal-code'] = '';
|
||||
$system['country-name'] = '';
|
||||
$system['homepage'] = DI::baseUrl();
|
||||
$system['homepage'] = (string)DI::baseUrl();
|
||||
$system['dob'] = '0000-00-00';
|
||||
|
||||
// Ensure that the user contains data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue