]> git.mxchange.org Git - friendica.git/commitdiff
Another foreign key added
authorMichael <heluecht@pirati.ca>
Mon, 24 Aug 2020 21:03:00 +0000 (21:03 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 24 Aug 2020 21:03:00 +0000 (21:03 +0000)
src/Worker/RepairDatabase.php
static/dbstructure.config.php
update.php

index 9d951dadc6fbcba282e501f7518dbbc317999bf9..2d7526953cf06f7121ba51b5ca6891b39d09a24c 100644 (file)
@@ -57,9 +57,9 @@ class RepairDatabase
                // Add intro entries for pending contacts
                // We don't do this for DFRN entries since such revived contact requests seem to mostly fail.
                $pending_contacts = DBA::p("SELECT `uid`, `id`, `url`, `network`, `created` FROM `contact`
-                       WHERE `pending` AND `rel` IN (?, ?) AND `network` != ?
+                       WHERE `pending` AND `rel` IN (?, ?) AND `network` != ? AND `uid` != ?
                                AND NOT EXISTS (SELECT `id` FROM `intro` WHERE `contact-id` = `contact`.`id`)",
-                       0, Contact::FOLLOWER, Protocol::DFRN);
+                       0, Contact::FOLLOWER, Protocol::DFRN, 0);
                while ($contact = DBA::fetch($pending_contacts)) {
                        DBA::insert('intro', ['uid' => $contact['uid'], 'contact-id' => $contact['id'], 'blocked' => false,
                                'hash' => Strings::getRandomHex(), 'datetime' => $contact['created']]);
index 65a14536e4b0927dbe24a7f01328c18df6ed70a4..8284ff8383b7b9daecf2193685f9e728ebe2e874 100755 (executable)
@@ -671,7 +671,7 @@ return [
                "comment" => "",
                "fields" => [
                        "id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
-                       "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "relation" => ["user" => "uid"], "comment" => "User id"],
+                       "uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
                        "fid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "relation" => ["fcontact" => "id"], "comment" => ""],
                        "contact-id" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "foreign" => ["contact" => "id"], "comment" => ""],
                        "knowyou" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
index a740019a82d837faa91b5fc25ecaeb2a59d43335..f163faf02f9ef740ebc69a3e2d2b24a1d58714e2 100644 (file)
@@ -614,6 +614,10 @@ function pre_update_1364()
                return Update::FAILED;
        }
 
+       if (!DBA::e("DELETE FROM `intro` WHERE NOT `uid` IN (SELECT `uid` FROM `user`)")) {
+               return Update::FAILED;
+       }
+
        if (!DBA::e("DELETE FROM `manage` WHERE NOT `uid` IN (SELECT `uid` FROM `user`)")) {
                return Update::FAILED;
        }