Merge pull request #9019 from annando/performance
Some performance tweaks
This commit is contained in:
commit
a7f8604d42
|
@ -2722,8 +2722,6 @@ class Item
|
||||||
'owner-id' => $owner_id, 'private' => $private, 'psid' => $psid];
|
'owner-id' => $owner_id, 'private' => $private, 'psid' => $psid];
|
||||||
self::update($fields, ['id' => $item_id]);
|
self::update($fields, ['id' => $item_id]);
|
||||||
|
|
||||||
self::updateThread($item_id);
|
|
||||||
|
|
||||||
Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'Notifier', Delivery::POST, $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
|
/// @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',
|
$fields = ['uid', 'guid', 'created', 'edited', 'commented', 'received', 'changed', 'post-type',
|
||||||
'wall', 'private', 'pubmail', 'moderated', 'visible', 'starred', 'contact-id', 'uri-id',
|
'wall', 'private', 'pubmail', 'moderated', 'visible', 'starred', 'contact-id', 'uri-id',
|
||||||
'deleted', 'origin', 'forum_mode', 'network', 'author-id', 'owner-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)) {
|
if (!DBA::isResult($item)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ class Profile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = self::getByNickname($nickname, $user['uid']);
|
$profile = User::getOwnerDataById($user['uid'], false);
|
||||||
|
|
||||||
if (empty($profile) && empty($profiledata)) {
|
if (empty($profile) && empty($profiledata)) {
|
||||||
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
|
Logger::log('profile error: ' . DI::args()->getQueryString(), Logger::DEBUG);
|
||||||
|
|
|
@ -97,6 +97,8 @@ class User
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
private static $owner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if a user record exists with the provided id
|
* Returns true if a user record exists with the provided id
|
||||||
*
|
*
|
||||||
|
@ -211,8 +213,12 @@ class User
|
||||||
* @return boolean|array
|
* @return boolean|array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function getOwnerDataById($uid, $check_valid = true)
|
public static function getOwnerDataById(int $uid, bool $check_valid = true)
|
||||||
{
|
{
|
||||||
|
if (!empty(self::$owner[$uid])) {
|
||||||
|
return self::$owner[$uid];
|
||||||
|
}
|
||||||
|
|
||||||
$owner = DBA::selectFirst('owner-view', [], ['uid' => $uid]);
|
$owner = DBA::selectFirst('owner-view', [], ['uid' => $uid]);
|
||||||
if (!DBA::isResult($owner)) {
|
if (!DBA::isResult($owner)) {
|
||||||
if (!DBA::exists('user', ['uid' => $uid]) || !$check_valid) {
|
if (!DBA::exists('user', ['uid' => $uid]) || !$check_valid) {
|
||||||
|
@ -256,6 +262,7 @@ class User
|
||||||
$owner = self::getOwnerDataById($uid, false);
|
$owner = self::getOwnerDataById($uid, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self::$owner[$uid] = $owner;
|
||||||
return $owner;
|
return $owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -729,6 +729,7 @@ return [
|
||||||
"resource-id" => ["resource-id"],
|
"resource-id" => ["resource-id"],
|
||||||
"deleted_changed" => ["deleted", "changed"],
|
"deleted_changed" => ["deleted", "changed"],
|
||||||
"uid_wall_changed" => ["uid", "wall", "changed"],
|
"uid_wall_changed" => ["uid", "wall", "changed"],
|
||||||
|
"uid_unseen_wall" => ["uid", "unseen", "wall"],
|
||||||
"mention_uid_id" => ["mention", "uid", "id"],
|
"mention_uid_id" => ["mention", "uid", "id"],
|
||||||
"uid_eventid" => ["uid", "event-id"],
|
"uid_eventid" => ["uid", "event-id"],
|
||||||
"icid" => ["icid"],
|
"icid" => ["icid"],
|
||||||
|
|
Loading…
Reference in a new issue