diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-03-08 18:03:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-08 18:03:49 +0100 |
commit | d40b21ac815b8088a5d0b51a6d48b39ed754631a (patch) | |
tree | 2913953835e4d6cc4a9c985f48391eb999132501 /settings | |
parent | 8996b9efbf61db703c73d4cfd872a83fe9d105e6 (diff) | |
parent | 060b637b70ed44ac09e400a435ca066c514ef09a (diff) | |
download | nextcloud-server-d40b21ac815b8088a5d0b51a6d48b39ed754631a.tar.gz nextcloud-server-d40b21ac815b8088a5d0b51a6d48b39ed754631a.zip |
Merge pull request #14603 from nextcloud/fix/noid/add-setup-check-for-s3-temp-path
Show a setup warning in case S3 object storage is used as primary storage
Diffstat (limited to 'settings')
-rw-r--r-- | settings/Controller/CheckSetupController.php | 37 |
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(), ] ); } |