summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-03-08 13:36:11 +0100
committerMorris Jobke <hey@morrisjobke.de>2019-03-08 13:38:39 +0100
commit060b637b70ed44ac09e400a435ca066c514ef09a (patch)
tree6240481ae2dd87c555c97d19b9c3340c5d56c5e3 /settings
parent49c7799496344ad1b5efa5295dad60c8595f4bf2 (diff)
downloadnextcloud-server-060b637b70ed44ac09e400a435ca066c514ef09a.tar.gz
nextcloud-server-060b637b70ed44ac09e400a435ca066c514ef09a.zip
Show a setup warning in case S3 object storage is used as primary storage
* checks for at least 50 GB of free space Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'settings')
-rw-r--r--settings/Controller/CheckSetupController.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php
index ba84762196c..b23c48f4466 100644
--- a/settings/Controller/CheckSetupController.php
+++ b/settings/Controller/CheckSetupController.php
@@ -628,6 +628,42 @@ Raw output
return $pendingColumns;
}
+ protected function isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(): bool {
+ $objectStore = $this->config->getSystemValue('objectstore', null);
+ $objectStoreMultibucket = $this->config->getSystemValue('objectstore_multibucket', null);
+
+ if (!isset($objectStoreMultibucket) && !isset($objectStore)) {
+ return true;
+ }
+
+ if (isset($objectStoreMultibucket['class']) && $objectStoreMultibucket['class'] !== 'OC\\Files\\ObjectStore\\S3') {
+ return true;
+ }
+
+ if (isset($objectStore['class']) && $objectStore['class'] !== 'OC\\Files\\ObjectStore\\S3') {
+ return true;
+ }
+
+ $tempPath = sys_get_temp_dir();
+ if (!is_dir($tempPath)) {
+ $this->logger->error('Error while checking the temporary PHP path - it was not properly set to a directory. value: ' . $tempPath);
+ return false;
+ }
+ $freeSpaceInTemp = disk_free_space($tempPath);
+ if ($freeSpaceInTemp === false) {
+ $this->logger->error('Error while checking the available disk space of temporary PHP path - no free disk space returned. temporary path: ' . $tempPath);
+ return false;
+ }
+
+ $freeSpaceInTempInGB = $freeSpaceInTemp / 1024 / 1024 / 1024;
+ if ($freeSpaceInTempInGB > 50) {
+ return true;
+ }
+
+ $this->logger->warning('Checking the available space in the temporary path resulted in ' . round($freeSpaceInTempInGB, 1) . ' GB instead of the recommended 50GB. Path: ' . $tempPath);
+ return false;
+ }
+
/**
* @return DataResponse
*/
@@ -669,6 +705,7 @@ Raw output
'recommendedPHPModules' => $this->hasRecommendedPHPModules(),
'pendingBigIntConversionColumns' => $this->hasBigIntConversionPendingColumns(),
'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(),
+ 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(),
]
);
}