diff options
author | Michael Weimann <mail@michael-weimann.eu> | 2018-08-04 20:39:39 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-08-20 15:24:10 +0200 |
commit | c2fced446396dad822404f3fae3ccb1c7df0dc89 (patch) | |
tree | 0d6daa452cd69b27ae534adcd92499747cde7e00 /settings | |
parent | 080572993e891a76721f4f7a7b76c85bc0e4c65d (diff) | |
download | nextcloud-server-c2fced446396dad822404f3fae3ccb1c7df0dc89.tar.gz nextcloud-server-c2fced446396dad822404f3fae3ccb1c7df0dc89.zip |
Adds a setup check for the memory limit
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
Diffstat (limited to 'settings')
-rw-r--r-- | settings/Controller/CheckSetupController.php | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php index c706d6e7350..eca67667471 100644 --- a/settings/Controller/CheckSetupController.php +++ b/settings/Controller/CheckSetupController.php @@ -39,6 +39,7 @@ use OC\DB\Connection; use OC\DB\MissingIndexInformation; use OC\IntegrityCheck\Checker; use OC\Lock\NoopLockingProvider; +use OC\MemoryInfo; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\DataResponse; @@ -81,6 +82,8 @@ class CheckSetupController extends Controller { private $lockingProvider; /** @var IDateTimeFormatter */ private $dateTimeFormatter; + /** @var MemoryInfo */ + private $memoryInfo; public function __construct($AppName, IRequest $request, @@ -94,7 +97,8 @@ class CheckSetupController extends Controller { EventDispatcherInterface $dispatcher, IDBConnection $db, ILockingProvider $lockingProvider, - IDateTimeFormatter $dateTimeFormatter) { + IDateTimeFormatter $dateTimeFormatter, + MemoryInfo $memoryInfo) { parent::__construct($AppName, $request); $this->config = $config; $this->clientService = $clientService; @@ -107,6 +111,7 @@ class CheckSetupController extends Controller { $this->db = $db; $this->lockingProvider = $lockingProvider; $this->dateTimeFormatter = $dateTimeFormatter; + $this->memoryInfo = $memoryInfo; } /** @@ -530,6 +535,16 @@ Raw output } /** + * Tests if the php memory limit is high enough. + * + * @return bool True if more than 512 MB available, else false. + */ + protected function isTheMemoryLimitHighEnough(): bool { + $memoryLimit = $this->memoryInfo->getMemoryLimit(); + return $memoryLimit === -1 || $memoryLimit >= 512 * 1024 * 1024; + } + + /** * @return DataResponse */ public function check() { @@ -565,7 +580,8 @@ Raw output 'isSqliteUsed' => $this->isSqliteUsed(), 'databaseConversionDocumentation' => $this->urlGenerator->linkToDocs('admin-db-conversion'), 'isPhpMailerUsed' => $this->isPhpMailerUsed(), - 'mailSettingsDocumentation' => $this->urlGenerator->getAbsoluteURL('index.php/settings/admin') + 'mailSettingsDocumentation' => $this->urlGenerator->getAbsoluteURL('index.php/settings/admin'), + 'isTheMemoryLimitHighEnough' => $this->isTheMemoryLimitHighEnough(), ] ); } |