From 03534247d378d06a8b68f778831179daaa7d57e2 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Fri, 28 Jun 2024 13:06:49 +0200 Subject: [PATCH] fix(setupchecks): skip check when disk_free_space is disabled Make it easier to discover that the check failed because disk_free_space is disabled. Signed-off-by: Daniel Kesselberg --- apps/settings/lib/SetupChecks/TempSpaceAvailable.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/settings/lib/SetupChecks/TempSpaceAvailable.php b/apps/settings/lib/SetupChecks/TempSpaceAvailable.php index 6a8aa1eab5117..a696c0bdc655a 100644 --- a/apps/settings/lib/SetupChecks/TempSpaceAvailable.php +++ b/apps/settings/lib/SetupChecks/TempSpaceAvailable.php @@ -84,7 +84,11 @@ public function run(): SetupResult { return SetupResult::error($this->l10n->t('Error while checking the temporary PHP path - it was not properly set to a directory. Returned value: %s', [$phpTempPath])); } - $freeSpaceInTemp = function_exists('disk_free_space') ? disk_free_space($phpTempPath) : false; + if (!function_exists('disk_free_space')) { + return SetupResult::info($this->l10n->t('The PHP function "disk_free_space" is disabled, which prevents the check for enough space in the temporary directories.')); + } + + $freeSpaceInTemp = disk_free_space($phpTempPath); if ($freeSpaceInTemp === false) { return SetupResult::error($this->l10n->t('Error while checking the available disk space of temporary PHP path or no free disk space returned. Temporary path: %s', [$phpTempPath])); } @@ -93,7 +97,7 @@ public function run(): SetupResult { $freeSpaceInTempInGB = $freeSpaceInTemp / 1024 / 1024 / 1024; $spaceDetail = $this->l10n->t('- %.1f GiB available in %s (PHP temporary directory)', [round($freeSpaceInTempInGB, 1),$phpTempPath]); if ($nextcloudTempPath !== $phpTempPath) { - $freeSpaceInNextcloudTemp = function_exists('disk_free_space') ? disk_free_space($nextcloudTempPath) : false; + $freeSpaceInNextcloudTemp = disk_free_space($nextcloudTempPath); if ($freeSpaceInNextcloudTemp === false) { return SetupResult::error($this->l10n->t('Error while checking the available disk space of temporary PHP path or no free disk space returned. Temporary path: %s', [$nextcloudTempPath])); }