mirror of
https://github.com/friendica/friendica
synced 2024-12-22 18:00:16 +00:00
Fix: "unsearchable" is now stored
This commit is contained in:
parent
57187f26ae
commit
eaddf5318a
7 changed files with 25 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
-- ------------------------------------------
|
||||
-- Friendica 2024.03-rc (Yellow Archangel)
|
||||
-- DB_UPDATE_VERSION 1556
|
||||
-- DB_UPDATE_VERSION 1557
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
|
|
@ -376,6 +376,9 @@ class APContact
|
|||
}
|
||||
|
||||
$apcontact['discoverable'] = JsonLD::fetchElement($compacted, 'toot:discoverable', '@value');
|
||||
if (is_null($apcontact['discoverable']) && ($apcontact['type'] == 'Application')) {
|
||||
$apcontact['discoverable'] = false;
|
||||
}
|
||||
|
||||
if (!empty($apcontact['photo'])) {
|
||||
$apcontact['photo'] = Network::addBasePath($apcontact['photo'], $apcontact['url']);
|
||||
|
|
|
@ -1130,7 +1130,7 @@ class Contact
|
|||
{
|
||||
// Always unarchive the relay contact entry
|
||||
if (!empty($contact['batch']) && !empty($contact['term-date']) && ($contact['term-date'] > DBA::NULL_DATETIME)) {
|
||||
$fields = ['failed' => false, 'term-date' => DBA::NULL_DATETIME, 'archive' => false];
|
||||
$fields = ['failed' => false, 'term-date' => DBA::NULL_DATETIME, 'archive' => false, 'unsearchable' => true];
|
||||
$condition = ['uid' => 0, 'network' => Protocol::FEDERATED, 'batch' => $contact['batch'], 'contact-type' => self::TYPE_RELAY];
|
||||
if (!DBA::exists('contact', array_merge($condition, $fields))) {
|
||||
self::update($fields, $condition);
|
||||
|
|
|
@ -118,7 +118,8 @@ class Probe
|
|||
'following', 'followers', 'inbox', 'outbox', 'sharedinbox',
|
||||
'priority', 'network', 'pubkey', 'manually-approve', 'baseurl', 'gsid'];
|
||||
|
||||
$numeric_fields = ['gsid', 'hide', 'account-type', 'manually-approve'];
|
||||
$numeric_fields = ['gsid', 'account-type'];
|
||||
$boolean_fields = ['hide', 'manually-approve'];
|
||||
|
||||
if (!empty($data['photo'])) {
|
||||
$data['photo'] = Network::addBasePath($data['photo'], $data['url']);
|
||||
|
@ -134,6 +135,8 @@ class Probe
|
|||
if (isset($data[$field])) {
|
||||
if (in_array($field, $numeric_fields)) {
|
||||
$newdata[$field] = (int)$data[$field];
|
||||
} elseif (in_array($field, $boolean_fields)) {
|
||||
$newdata[$field] = (bool)$data[$field];
|
||||
} else {
|
||||
$newdata[$field] = trim($data[$field]);
|
||||
}
|
||||
|
|
|
@ -246,13 +246,14 @@ class Relay
|
|||
$fields['contact-type'] = Contact::TYPE_RELAY;
|
||||
Logger::info('Assigning missing data for relay contact', ['server' => $gserver['url'], 'id' => $old['id']]);
|
||||
}
|
||||
} elseif (empty($fields)) {
|
||||
} elseif (empty($fields) && $old['unsearchable']) {
|
||||
Logger::info('No content to update, quitting', ['server' => $gserver['url']]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (DBA::isResult($old)) {
|
||||
$fields['updated'] = DateTimeFormat::utcNow();
|
||||
$fields['unsearchable'] = true;
|
||||
|
||||
Logger::info('Update relay contact', ['server' => $gserver['url'], 'id' => $old['id'], 'fields' => $fields]);
|
||||
Contact::update($fields, ['id' => $old['id']], $old);
|
||||
|
@ -265,6 +266,7 @@ class Relay
|
|||
'rel' => Contact::FOLLOWER, 'blocked' => false,
|
||||
'pending' => false, 'writable' => true,
|
||||
'gsid' => $gserver['id'],
|
||||
'unsearchable' => true,
|
||||
'baseurl' => $gserver['url'], 'contact-type' => Contact::TYPE_RELAY];
|
||||
|
||||
$fields = array_merge($default, $fields);
|
||||
|
|
|
@ -56,7 +56,7 @@ use Friendica\Database\DBA;
|
|||
|
||||
// This file is required several times during the test in DbaDefinition which justifies this condition
|
||||
if (!defined('DB_UPDATE_VERSION')) {
|
||||
define('DB_UPDATE_VERSION', 1556);
|
||||
define('DB_UPDATE_VERSION', 1557);
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
11
update.php
11
update.php
|
@ -63,6 +63,7 @@ use Friendica\Protocol\Activity;
|
|||
use Friendica\Protocol\Delivery;
|
||||
use Friendica\Security\PermissionSet\Repository\PermissionSet;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Worker\UpdateContact;
|
||||
|
||||
// Post-update script of PR 5751
|
||||
function update_1298()
|
||||
|
@ -1447,3 +1448,13 @@ function update_1556()
|
|||
|
||||
return Update::SUCCESS;
|
||||
}
|
||||
|
||||
function update_1557()
|
||||
{
|
||||
$contacts = DBA::select('account-view', ['id'], ['platform' => 'friendica', 'contact-type' => Contact::TYPE_RELAY]);
|
||||
while ($contact = DBA::fetch($contacts)) {
|
||||
UpdateContact::add(Worker::PRIORITY_LOW, $contact['id']);
|
||||
}
|
||||
DBA::close($contacts);
|
||||
return Update::SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue