diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-05-11 17:10:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-11 17:10:45 +0200 |
commit | 23b6f0e4d72f0a70eec9b4ba69ba9e5a0cb72731 (patch) | |
tree | bb0e3c34d1290c258424e3b8ce6e1d757c53bdcc /lib | |
parent | ec0c7fd104e7cc2edd029160433bdcba008849b4 (diff) | |
parent | abe4a19cbc44b34bf171d1e9499c3e834364bd31 (diff) | |
download | nextcloud-server-23b6f0e4d72f0a70eec9b4ba69ba9e5a0cb72731.tar.gz nextcloud-server-23b6f0e4d72f0a70eec9b4ba69ba9e5a0cb72731.zip |
Merge pull request #4804 from nextcloud/proper-upgrade-size
Properly decide on actual users if instance is too big
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 24 |
1 files changed, 23 insertions, 1 deletions
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(); |