]> git.mxchange.org Git - friendica.git/commitdiff
Fix: "unsearchable" is now stored
authorMichael <heluecht@pirati.ca>
Fri, 15 Mar 2024 06:07:47 +0000 (06:07 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 15 Mar 2024 06:07:47 +0000 (06:07 +0000)
database.sql
src/Model/APContact.php
src/Model/Contact.php
src/Network/Probe.php
src/Protocol/Relay.php
static/dbstructure.config.php
update.php

index ae71114e5b0241a2b699758683cf2e49a62d58e9..b4f18a26850a2516ed5e9c3193286f8e3085f660 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2024.03-rc (Yellow Archangel)
--- DB_UPDATE_VERSION 1556
+-- DB_UPDATE_VERSION 1557
 -- ------------------------------------------
 
 
index 392f56ea4367659dea9d5b3ca406151a8f4498ce..0b8a78a999ea3a026733b2b0cbbbd45e1261cbae 100644 (file)
@@ -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']);
index 3b09991cff57b6f4908a825b4323eec7f895a17e..a04d1a5382fba259a46f812d51a47f6a92badd24 100644 (file)
@@ -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);
index fc5125f2594fed0cc4cda96429d4ad429f1468c4..712c3c6dfdcfe3c77baf1cfce23e62bbee571734 100644 (file)
@@ -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]);
                                }
index d57cac21bf880dcd7b634acf1d666c532e00598a..8dd5e13c04bbe9de36f32a2ad73ad0e4e1a1cc48 100644 (file)
@@ -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['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);
index cfda0558186285ee086484cc2244f9b6bad760cf..8206ca34fbde5afe3612eb3713ece03fa506b31e 100644 (file)
@@ -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 [
index ffdfa5561888c0127c5ab3fe57122f33da573744..5295d0b2102e6848c8263645f32a335f13ceb5a3 100644 (file)
@@ -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;
+}