simplify SQLite warning

This commit is contained in:
Morris Jobke 2014-06-03 12:02:23 +02:00
parent f88482355f
commit 25c676f203
2 changed files with 5 additions and 25 deletions

View File

@ -89,27 +89,7 @@ foreach($forms as $form) {
$tmpl->append('forms', $form); $tmpl->append('forms', $form);
} }
$databaseOverload = false; $databaseOverload = (strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== 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->assign('databaseOverload', $databaseOverload);
$tmpl->printPage(); $tmpl->printPage();

View File

@ -102,11 +102,11 @@ if (!$_['isAnnotationsWorking']) {
if ($_['databaseOverload']) { if ($_['databaseOverload']) {
?> ?>
<div class="section"> <div class="section">
<h2><?php p($l->t('Database Performance Warning'));?></h2> <h2><?php p($l->t('Database Performance Info'));?></h2>
<span class="securitywarning"> <p class="securitywarning">
<?php p($l->t('SQLite will be used as database. For larger installations we recommend to change this.')); ?> <?php p($l->t('SQLite is used as database. For larger installations we recommend to change this. To migrate to another database use the command line tool: \'occ db:convert-type\'')); ?>
</span> </p>
</div> </div>
<?php <?php