summaryrefslogtreecommitdiffstats
path: root/settings/admin.php
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2014-06-03 11:39:16 +0200
committerMorris Jobke <morris.jobke@gmail.com>2014-06-03 11:39:16 +0200
commitf88482355f01209d6f0d2cc553f9d1822dc35c58 (patch)
treec3fea17966cea3666a7e4e3c62214986ec2ca2ba /settings/admin.php
parent68a4fd44e62852453e65eca31f319842573be969 (diff)
downloadnextcloud-server-f88482355f01209d6f0d2cc553f9d1822dc35c58.tar.gz
nextcloud-server-f88482355f01209d6f0d2cc553f9d1822dc35c58.zip
check for user count and files count
Diffstat (limited to 'settings/admin.php')
-rwxr-xr-xsettings/admin.php25
1 files changed, 22 insertions, 3 deletions
diff --git a/settings/admin.php b/settings/admin.php
index 2a33dfb45fb..c26475c3c54 100755
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -89,9 +89,28 @@ foreach($forms as $form) {
$tmpl->append('forms', $form);
}
-// TODO - replace by:
-// > 5 users OR > 1000 files
-$tmpl->assign('databaseOverload', true);
+$databaseOverload = false;
+if(strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false){
+ // > 5 users
+ $userCount = 0;
+ foreach (\OC::$server->getUserManager()->countUsers() as $classname => $count) {
+ $userCount += $count;
+ }
+ if($userCount >= 5){
+ $databaseOverload = true;
+ }
+
+ // OR > 1000 files
+ $sql = 'SELECT COUNT(*) FROM *PREFIX*filecache;';
+ $query = \OCP\DB::prepare($sql);
+ $row = $query->execute()->fetchRow();
+ $fileCount = $row['COUNT(*)'];
+
+ if($fileCount >= 1000){
+ $databaseOverload = true;
+ }
+}
+$tmpl->assign('databaseOverload', $databaseOverload);
$tmpl->printPage();