-- ------------------------------------------
--- Friendica 2023.09-dev (Giant Rhubarb)
--- DB_UPDATE_VERSION 1534
+-- Friendica 2023.09-rc (Giant Rhubarb)
+-- DB_UPDATE_VERSION 1535
-- ------------------------------------------
*
* Count unread items of each circle of the local user
*
+ * @param int $uid
* @return array
* 'id' => circle id
* 'name' => circle name
* 'count' => counted unseen circle items
* @throws \Exception
*/
- public static function countUnseen()
+ public static function countUnseen(int $uid)
{
$stmt = DBA::p("SELECT `circle`.`id`, `circle`.`name`,
- (SELECT COUNT(*) FROM `post-user-view`
+ (SELECT COUNT(*) FROM `post-user`
WHERE `uid` = ?
AND `unseen`
AND `contact-id` IN
) AS `count`
FROM `group` AS `circle`
WHERE `circle`.`uid` = ?;",
- DI::userSession()->getLocalUserId(),
- DI::userSession()->getLocalUserId()
+ $uid,
+ $uid
);
return DBA::toArray($stmt);
'$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.')],
'$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_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.')],
}
}
- $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) {
// 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) {
$circles_unseen[] = $circle_count;
}
// This file is required several times during the test in DbaDefinition which justifies this condition
if (!defined('DB_UPDATE_VERSION')) {
- define('DB_UPDATE_VERSION', 1534);
+ define('DB_UPDATE_VERSION', 1535);
}
return [
}
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;
}
\ No newline at end of file