Skip to content

Commit

Permalink
fix(setupchecks): skip check when disk_free_space is disabled
Browse files Browse the repository at this point in the history
Make it easier to discover that the check failed because disk_free_space is disabled.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb committed Jun 28, 2024
1 parent 8ec5360 commit fd9fd1b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/settings/lib/SetupChecks/TempSpaceAvailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,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]));
}
Expand All @@ -76,7 +80,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]));
}
Expand Down

0 comments on commit fd9fd1b

Please sign in to comment.