]> git.mxchange.org Git - friendica.git/commitdiff
Some performance tweeks
authorMichael Vogel <icarus@dabo.de>
Sun, 16 Aug 2020 11:57:56 +0000 (13:57 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 16 Aug 2020 11:57:56 +0000 (13:57 +0200)
src/Model/Item.php
src/Model/Profile.php
src/Model/User.php
static/dbstructure.config.php
static/dbview.config.php

index a19357635b6a09f9972931d2126a22b0ee9e57d4..0050f930982a1f488a8e9f99ce63698905b86c55 100644 (file)
@@ -2722,8 +2722,6 @@ class Item
                        'owner-id' => $owner_id, 'private' => $private, 'psid' => $psid];
                self::update($fields, ['id' => $item_id]);
 
-               self::updateThread($item_id);
-
                Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'Notifier', Delivery::POST, $item_id);
 
                /// @todo This code should be activated by the end of the year 2020
@@ -3285,9 +3283,8 @@ class Item
                $fields = ['uid', 'guid', 'created', 'edited', 'commented', 'received', 'changed', 'post-type',
                        'wall', 'private', 'pubmail', 'moderated', 'visible', 'starred', 'contact-id', 'uri-id',
                        'deleted', 'origin', 'forum_mode', 'network', 'author-id', 'owner-id'];
-               $condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid];
 
-               $item = self::selectFirst($fields, $condition);
+               $item = self::selectFirst($fields, ['id' => $itemid, 'gravity' => GRAVITY_PARENT]);
                if (!DBA::isResult($item)) {
                        return;
                }
index 0cff8ba287f0923f56657ccb3ef39a0c6d9d0fd5..3cd3afe6cbea0f654bfad4648935522181d30df6 100644 (file)
@@ -166,7 +166,7 @@ class Profile
                        }
                }
 
-               $profile = self::getByNickname($nickname, $user['uid']);
+               $profile = User::getOwnerDataById($user['uid'], false);
 
                if (empty($profile) && empty($profiledata)) {
                        Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
index 46f0776b4e1e7a89eae87a61fb81d788781594a5..8730fa8c9accbda4cf5c6467b4ef89f4654348f3 100644 (file)
@@ -97,6 +97,8 @@ class User
         * @}
         */
 
+       private static $owner;
+
        /**
         * Returns true if a user record exists with the provided id
         *
@@ -213,6 +215,10 @@ class User
         */
        public static function getOwnerDataById($uid, $check_valid = true)
        {
+               if (!empty(self::$owner)) {
+                       return self::$owner;
+               }
+
                $owner = DBA::selectFirst('owner-view', [], ['uid' => $uid]);
                if (!DBA::isResult($owner)) {
                        if (!DBA::exists('user', ['uid' => $uid]) || !$check_valid) {
@@ -256,6 +262,7 @@ class User
                        $owner = self::getOwnerDataById($uid, false);
                }
 
+               self::$owner = $owner;
                return $owner;
        }
 
index aa1552f9c0018b374963561c547f326e3ad724f8..b040e66ee327dd8ab792995182886a7e19c27f20 100755 (executable)
@@ -202,7 +202,7 @@ return [
                        "dfrn-id" => ["dfrn-id(64)"],
                        "issued-id" => ["issued-id(64)"],
                        "network_uid_lastupdate" => ["network", "uid", "last-update"],
-                       "uid_lastitem" => ["uid", "last-item"],                 
+                       "uid_lastitem" => ["uid", "last-item"],
                        "gsid" => ["gsid"]
                ]
        ],
@@ -729,6 +729,7 @@ return [
                        "resource-id" => ["resource-id"],
                        "deleted_changed" => ["deleted", "changed"],
                        "uid_wall_changed" => ["uid", "wall", "changed"],
+                       "uid_unseen_wall" => ["uid", "unseen", "wall"],
                        "mention_uid_id" => ["mention", "uid", "id"],
                        "uid_eventid" => ["uid", "event-id"],
                        "icid" => ["icid"],
index 55cfd0155e8d37a553aaa0324a6af672e9c0682a..95179045c5caefa91647b81cecbf4d41f81e9ebb 100755 (executable)
@@ -230,7 +230,7 @@ return [
                        "account_removed" => ["user", "account_removed"],
                        "account_expired" => ["user", "account_expired"],
                        "account_expires_on" => ["user", "account_expires_on"],
-                       "expire_notification_sent" => ["user", "expire_notification_sent"],                     
+                       "expire_notification_sent" => ["user", "expire_notification_sent"],
                        "def_gid" => ["user", "def_gid"],
                        "allow_cid" => ["user", "allow_cid"],
                        "allow_gid" => ["user", "allow_gid"],