check for user count and files count
This commit is contained in:
parent
68a4fd44e6
commit
f88482355f
1 changed files with 22 additions and 3 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue