summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-01-16 13:50:44 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2024-03-18 11:10:54 +0100
commit11cde3096a17157ad3896a9f641828e60af04bfd (patch)
treeaf9dfd3c3df751e226c5396557cf89914007f0b6 /apps
parent9dcf13fa1295ecbb582fd793aa301dff47f0bd77 (diff)
downloadnextcloud-server-11cde3096a17157ad3896a9f641828e60af04bfd.tar.gz
nextcloud-server-11cde3096a17157ad3896a9f641828e60af04bfd.zip
Remove old version of temporary space setup check and fix tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/settings/lib/Controller/CheckSetupController.php37
-rw-r--r--apps/settings/tests/Controller/CheckSetupControllerTest.php51
2 files changed, 0 insertions, 88 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php
index bc898060928..ba39579e445 100644
--- a/apps/settings/lib/Controller/CheckSetupController.php
+++ b/apps/settings/lib/Controller/CheckSetupController.php
@@ -202,42 +202,6 @@ Raw output
return false;
}
- 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. Returned value: ' . $tempPath);
- return false;
- }
- $freeSpaceInTemp = function_exists('disk_free_space') ? disk_free_space($tempPath) : false;
- if ($freeSpaceInTemp === false) {
- $this->logger->error('Error while checking the available disk space of temporary PHP path or 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
* @AuthorizedAdminSetting(settings=OCA\Settings\Settings\Admin\Overview)
@@ -247,7 +211,6 @@ Raw output
[
'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(),
'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'),
- 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(),
'reverseProxyGeneratedURL' => $this->urlGenerator->getAbsoluteURL('index.php'),
'temporaryDirectoryWritable' => $this->isTemporaryDirectoryWritable(),
'generic' => $this->setupCheckManager->runAll(),
diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php
index b888e0ce7c8..f8c9b346e7d 100644
--- a/apps/settings/tests/Controller/CheckSetupControllerTest.php
+++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php
@@ -118,7 +118,6 @@ class CheckSetupControllerTest extends TestCase {
'getCurlVersion',
'isPhpOutdated',
'isPHPMailerUsed',
- 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed',
])->getMock();
}
@@ -141,11 +140,6 @@ class CheckSetupControllerTest extends TestCase {
$this->request->expects($this->never())
->method('getHeader');
- $this->checkSetupController
- ->expects($this->once())
- ->method('isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed')
- ->willReturn(true);
-
$this->urlGenerator->method('linkToDocs')
->willReturnCallback(function (string $key): string {
if ($key === 'admin-performance') {
@@ -180,7 +174,6 @@ class CheckSetupControllerTest extends TestCase {
$expected = new DataResponse(
[
'reverseProxyDocs' => 'reverse-proxy-doc-link',
- 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => true,
'reverseProxyGeneratedURL' => 'https://server/index.php',
'isFairUseOfFreePushService' => false,
'temporaryDirectoryWritable' => false,
@@ -645,48 +638,4 @@ Array
);
$this->assertEquals($expected, $this->checkSetupController->getFailedIntegrityCheckFiles());
}
-
- public function dataForIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed() {
- return [
- ['singlebucket', 'OC\\Files\\ObjectStore\\Swift', true],
- ['multibucket', 'OC\\Files\\ObjectStore\\Swift', true],
- ['singlebucket', 'OC\\Files\\ObjectStore\\Custom', true],
- ['multibucket', 'OC\Files\\ObjectStore\\Custom', true],
- ['singlebucket', 'OC\Files\ObjectStore\Swift', true],
- ['multibucket', 'OC\Files\ObjectStore\Swift', true],
- ['singlebucket', 'OC\Files\ObjectStore\Custom', true],
- ['multibucket', 'OC\Files\ObjectStore\Custom', true],
- ];
- }
-
- /**
- * @dataProvider dataForIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed
- */
- public function testIsEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(string $mode, string $className, bool $expected) {
- $this->config->method('getSystemValue')
- ->willReturnCallback(function ($key, $default) use ($mode, $className) {
- if ($key === 'objectstore' && $mode === 'singlebucket') {
- return ['class' => $className];
- }
- if ($key === 'objectstore_multibucket' && $mode === 'multibucket') {
- return ['class' => $className];
- }
- return $default;
- });
-
- $checkSetupController = new CheckSetupController(
- 'settings',
- $this->request,
- $this->config,
- $this->urlGenerator,
- $this->l10n,
- $this->checker,
- $this->logger,
- $this->tempManager,
- $this->notificationManager,
- $this->setupCheckManager,
- );
-
- $this->assertSame($expected, $this->invokePrivate($checkSetupController, 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed'));
- }
}