diff options
Diffstat (limited to 'app/Controllers')
| -rw-r--r-- | app/Controllers/configureController.php | 2 | ||||
| -rw-r--r-- | app/Controllers/userController.php | 24 |
2 files changed, 16 insertions, 10 deletions
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 86943e663..8bc0d08c4 100644 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -369,7 +369,7 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController { $this->view->size_user = $databaseDAO->size(); if (FreshRSS_Auth::hasAccess('admin')) { - $this->view->size_total = $databaseDAO->size(true); + $this->view->size_total = $databaseDAO->size(all: true); } FreshRSS_View::prependTitle(_t('conf.archiving.title') . ' · '); diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 84ef85335..6f5b27280 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -328,8 +328,14 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController { $this->view->show_email_field = FreshRSS_Context::systemConf()->force_email_validation; $this->view->current_user = Minz_Request::paramString('u'); + $fast = false; + $startTime = time(); foreach (self::listUsers() as $user) { - $this->view->users[$user] = $this->retrieveUserDetails($user); + if (!$fast && (time() - $startTime >= 3)) { + // Disable detailed user statistics if it takes too long, and will retrieve them asynchronously via JavaScript + $fast = true; + } + $this->view->users[$user] = $this->retrieveUserDetails($user, $fast); } } @@ -806,11 +812,11 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController { FreshRSS_View::prependTitle($username . ' · ' . _t('gen.menu.user_management') . ' · '); } - /** @return array{'feed_count':int,'article_count':int,'database_size':int,'language':string,'mail_login':string,'enabled':bool,'is_admin':bool,'last_user_activity':string,'is_default':bool} */ - private function retrieveUserDetails(string $username): array { - $feedDAO = FreshRSS_Factory::createFeedDao($username); - $entryDAO = FreshRSS_Factory::createEntryDao($username); - $databaseDAO = FreshRSS_Factory::createDatabaseDAO($username); + /** @return array{feed_count:?int,article_count:?int,database_size:?int,language:string,mail_login:string,enabled:bool,is_admin:bool,last_user_activity:string,is_default:bool} */ + private function retrieveUserDetails(string $username, bool $fast = false): array { + $feedDAO = $fast ? null : FreshRSS_Factory::createFeedDao($username); + $entryDAO = $fast ? null : FreshRSS_Factory::createEntryDao($username); + $databaseDAO = $fast ? null : FreshRSS_Factory::createDatabaseDAO($username); $userConfiguration = FreshRSS_UserConfiguration::getForUser($username); if ($userConfiguration === null) { @@ -818,9 +824,9 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController { } return [ - 'feed_count' => $feedDAO->count(), - 'article_count' => $entryDAO->count(), - 'database_size' => $databaseDAO->size(), + 'feed_count' => isset($feedDAO) ? $feedDAO->count() : null, + 'article_count' => isset($entryDAO) ? $entryDAO->count() : null, + 'database_size' => isset($databaseDAO) ? $databaseDAO->size() : null, 'language' => $userConfiguration->language, 'mail_login' => $userConfiguration->mail_login, 'enabled' => $userConfiguration->enabled, |
