]> source.dussan.org Git - nextcloud-server.git/commitdiff
Properly decide on actual users if instance is too big 4804/head
authorMorris Jobke <hey@morrisjobke.de>
Thu, 11 May 2017 02:39:09 +0000 (21:39 -0500)
committerMorris Jobke <hey@morrisjobke.de>
Thu, 11 May 2017 03:32:42 +0000 (22:32 -0500)
* state the reason why NC thinks it is a big instance

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
core/templates/update.use-cli.php
lib/base.php

index 52d40cdea5591d192d7bb904e4600231140cd6cd..9fbdbca8b21520cd67ce68498aa009db47935a7d 100644 (file)
@@ -3,7 +3,7 @@
                <h2 class="title"><?php p($l->t('Update needed')) ?></h2>
                <div class="infogroup">
                        <?php if ($_['tooBig']) {
-                               p($l->t('Please use the command line updater because you have a big instance.'));
+                               p($l->t('Please use the command line updater because you have a big instance with more than 50 users.'));
                        } else {
                                p($l->t('Please use the command line updater because automatic updating is disabled in the config.php.'));
                        } ?><br><br>
index 69ea6e54c2d5b89989d13fa4d3f35d61121b3240..483cd6569166907c0990a7c3b42c0f5255170399 100644 (file)
@@ -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();