From abe4a19cbc44b34bf171d1e9499c3e834364bd31 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 10 May 2017 21:39:09 -0500 Subject: Properly decide on actual users if instance is too big * state the reason why NC thinks it is a big instance Signed-off-by: Morris Jobke --- lib/base.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/base.php b/lib/base.php index 69ea6e54c2d..483cd656916 100644 --- a/lib/base.php +++ b/lib/base.php @@ -313,7 +313,29 @@ class OC { $tooBig = false; if (!$disableWebUpdater) { $apps = \OC::$server->getAppManager(); - $tooBig = $apps->isInstalled('user_ldap') || $apps->isInstalled('user_shibboleth'); + $tooBig = false; + if ($apps->isInstalled('user_ldap')) { + $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + + $result = $qb->selectAlias($qb->createFunction('COUNT(*)'), 'user_count') + ->from('ldap_user_mapping') + ->execute(); + $row = $result->fetch(); + $result->closeCursor(); + + $tooBig = ($row['user_count'] > 50); + } + if (!$tooBig && $apps->isInstalled('user_saml')) { + $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + + $result = $qb->selectAlias($qb->createFunction('COUNT(*)'), 'user_count') + ->from('user_saml_users') + ->execute(); + $row = $result->fetch(); + $result->closeCursor(); + + $tooBig = ($row['user_count'] > 50); + } if (!$tooBig) { // count users $stats = \OC::$server->getUserManager()->countUsers(); -- cgit v1.2.3