Merge remote-tracking branch 'upstream/2023.09-rc' into user-defined-channels

This commit is contained in:
Michael 2023-10-05 18:19:38 +00:00
commit bc3bdf3cb0
5 changed files with 19 additions and 8 deletions

View File

@ -1,5 +1,5 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 2023.09-dev (Giant Rhubarb) -- Friendica 2023.09-rc (Giant Rhubarb)
-- DB_UPDATE_VERSION 1535 -- DB_UPDATE_VERSION 1535
-- ------------------------------------------ -- ------------------------------------------

View File

@ -169,16 +169,17 @@ class Circle
* *
* Count unread items of each circle of the local user * Count unread items of each circle of the local user
* *
* @param int $uid
* @return array * @return array
* 'id' => circle id * 'id' => circle id
* 'name' => circle name * 'name' => circle name
* 'count' => counted unseen circle items * 'count' => counted unseen circle items
* @throws \Exception * @throws \Exception
*/ */
public static function countUnseen() public static function countUnseen(int $uid)
{ {
$stmt = DBA::p("SELECT `circle`.`id`, `circle`.`name`, $stmt = DBA::p("SELECT `circle`.`id`, `circle`.`name`,
(SELECT COUNT(*) FROM `post-user-view` (SELECT COUNT(*) FROM `post-user`
WHERE `uid` = ? WHERE `uid` = ?
AND `unseen` AND `unseen`
AND `contact-id` IN AND `contact-id` IN
@ -188,8 +189,8 @@ class Circle
) AS `count` ) AS `count`
FROM `group` AS `circle` FROM `group` AS `circle`
WHERE `circle`.`uid` = ?;", WHERE `circle`.`uid` = ?;",
DI::userSession()->getLocalUserId(), $uid,
DI::userSession()->getLocalUserId() $uid
); );
return DBA::toArray($stmt); return DBA::toArray($stmt);

View File

@ -504,7 +504,7 @@ class Site extends BaseAdmin
'$max_display_comments' => ['max_display_comments', DI::l10n()->t('Maximum numbers of comments per post on the display page'), DI::config()->get('system', 'max_display_comments'), DI::l10n()->t('How many comments should be shown on the single view for each post? Default value is 1000.')], '$max_display_comments' => ['max_display_comments', DI::l10n()->t('Maximum numbers of comments per post on the display page'), DI::config()->get('system', 'max_display_comments'), DI::l10n()->t('How many comments should be shown on the single view for each post? Default value is 1000.')],
'$temppath' => ['temppath', DI::l10n()->t('Temp path'), DI::config()->get('system', 'temppath'), DI::l10n()->t('If you have a restricted system where the webserver can\'t access the system temp path, enter another path here.')], '$temppath' => ['temppath', DI::l10n()->t('Temp path'), DI::config()->get('system', 'temppath'), DI::l10n()->t('If you have a restricted system where the webserver can\'t access the system temp path, enter another path here.')],
'$only_tag_search' => ['only_tag_search', DI::l10n()->t('Only search in tags'), DI::config()->get('system', 'only_tag_search'), DI::l10n()->t('On large systems the text search can slow down the system extremely.')], '$only_tag_search' => ['only_tag_search', DI::l10n()->t('Only search in tags'), DI::config()->get('system', 'only_tag_search'), DI::l10n()->t('On large systems the text search can slow down the system extremely.')],
'$compute_circle_counts' => ['compute_circle_counts', DI::l10n()->t('Generate counts per contact circle when calculating network count'), DI::config()->get('system', 'compute_group_counts') ?? DI::config()->get('system', 'compute_circle_counts'), DI::l10n()->t('On systems with users that heavily use contact circles the query can be very expensive.')], '$compute_circle_counts' => ['compute_circle_counts', DI::l10n()->t('Generate counts per contact circle when calculating network count'), DI::config()->get('system', 'compute_circle_counts'), DI::l10n()->t('On systems with users that heavily use contact circles the query can be very expensive.')],
'$worker_queues' => ['worker_queues', DI::l10n()->t('Maximum number of parallel workers'), DI::config()->get('system', 'worker_queues'), DI::l10n()->t('On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.', 5, 20, 10)], '$worker_queues' => ['worker_queues', DI::l10n()->t('Maximum number of parallel workers'), DI::config()->get('system', 'worker_queues'), DI::l10n()->t('On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.', 5, 20, 10)],
'$worker_fastlane' => ['worker_fastlane', DI::l10n()->t('Enable fastlane'), DI::config()->get('system', 'worker_fastlane'), DI::l10n()->t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')], '$worker_fastlane' => ['worker_fastlane', DI::l10n()->t('Enable fastlane'), DI::config()->get('system', 'worker_fastlane'), DI::l10n()->t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')],

View File

@ -152,10 +152,10 @@ class Ping extends BaseModule
} }
} }
$compute_circle_counts = $this->config->get('system','compute_group_counts') ?? $this->config->get('system','compute_circle_counts'); $compute_circle_counts = $this->config->get('system','compute_circle_counts');
if ($network_count && $compute_circle_counts) { if ($network_count && $compute_circle_counts) {
// Find out how unseen network posts are spread across circles // Find out how unseen network posts are spread across circles
foreach (Circle::countUnseen() as $circle_count) { foreach (Circle::countUnseen($this->session->getLocalUserId()) as $circle_count) {
if ($circle_count['count'] > 0) { if ($circle_count['count'] > 0) {
$circles_unseen[] = $circle_count; $circles_unseen[] = $circle_count;
} }

View File

@ -1388,5 +1388,15 @@ function update_1531()
} }
DBA::close($threads); DBA::close($threads);
return Update::SUCCESS;
}
function update_1535()
{
if (DI::config()->get('system', 'compute_group_counts')) {
DI::config()->set('system', 'compute_circle_counts', true);
}
DI::config()->delete('system', 'compute_group_counts');
return Update::SUCCESS; return Update::SUCCESS;
} }