]> git.mxchange.org Git - friendica.git/commitdiff
Fix speed issues with the network page
authorMichael Vogel <icarus@dabo.de>
Thu, 9 Jul 2020 22:22:26 +0000 (00:22 +0200)
committerMichael Vogel <icarus@dabo.de>
Thu, 9 Jul 2020 22:22:26 +0000 (00:22 +0200)
src/Content/Item.php
src/Model/Item.php
static/dbstructure.config.php

index 40deb976c778386df3ba3793cb5386b0983b6e00..f39a8fa19db367f5b65aed09a6b89203dc6ddee7 100644 (file)
@@ -168,10 +168,17 @@ class Item
                                        $contact = DBA::selectFirst('contact', $fields, ['id' => $tagcid, 'uid' => $profile_uid]);
                                }
 
-                               // select someone by nick or attag in the current network
+                               // select someone by nick in the current network
                                if (!DBA::isResult($contact) && ($network != '')) {
-                                       $condition = ["(`nick` = ? OR `attag` = ?) AND `network` = ? AND `uid` = ?",
-                                               $name, $name, $network, $profile_uid];
+                                       $condition = ["`nick` = ? AND `network` = ? AND `uid` = ?",
+                                               $name, $network, $profile_uid];
+                                       $contact = DBA::selectFirst('contact', $fields, $condition);
+                               }
+
+                               // select someone by attag in the current network
+                               if (!DBA::isResult($contact) && ($network != '')) {
+                                       $condition = ["`attag` = ? AND `network` = ? AND `uid` = ?",
+                                               $name, $network, $profile_uid];
                                        $contact = DBA::selectFirst('contact', $fields, $condition);
                                }
 
@@ -181,9 +188,15 @@ class Item
                                        $contact = DBA::selectFirst('contact', $fields, $condition);
                                }
 
-                               // select someone by nick or attag in any network
+                               // select someone by nick in any network
+                               if (!DBA::isResult($contact)) {
+                                       $condition = ["`nick` = ? AND `uid` = ?", $name, $profile_uid];
+                                       $contact = DBA::selectFirst('contact', $fields, $condition);
+                               }
+
+                               // select someone by attag in any network
                                if (!DBA::isResult($contact)) {
-                                       $condition = ["(`nick` = ? OR `attag` = ?) AND `uid` = ?", $name, $name, $profile_uid];
+                                       $condition = ["`attag` = ? AND `uid` = ?", $name, $profile_uid];
                                        $contact = DBA::selectFirst('contact', $fields, $condition);
                                }
 
index 0872db3ca559d9acfcfc07ecb9deda8af18ed64b..4fff3655626d8af82e3d60e3b20b49de222320be 100644 (file)
@@ -1838,7 +1838,7 @@ class Item
                if (!Tag::existsForPost($item['uri-id'])) {
                        Tag::storeFromBody($item['uri-id'], $body);
                }
-               
+
                $ret = DBA::insert('item', $item);
 
                // When the item was successfully stored we fetch the ID of the item.
@@ -2022,9 +2022,7 @@ class Item
                }
 
                if (empty($fields)) {
-                       // when there are no fields at all, just use the condition
-                       // This is to ensure that we always store content.
-                       $fields = $condition;
+                       return;
                }
 
                DBA::update('item-content', $fields, $condition, true);
index f1b5dbaecf7a820d478abcfca64836c2a62db3e0..bab158d036759faba477a9792530e32e37378f67 100755 (executable)
@@ -54,7 +54,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1354);
+       define('DB_UPDATE_VERSION', 1355);
 }
 
 return [
@@ -195,6 +195,7 @@ return [
                        "addr_uid" => ["addr(32)", "uid"],
                        "nurl_uid" => ["nurl(32)", "uid"],
                        "nick_uid" => ["nick(32)", "uid"],
+                       "attag_uid" => ["attag(32)", "uid"],
                        "dfrn-id" => ["dfrn-id(64)"],
                        "issued-id" => ["issued-id(64)"],
                        "gsid" => ["gsid"]