Skip to content

Commit 9068bf5

Browse files
authored
Merge pull request #34505 from nextcloud/backport/30608/stable25
[stable25] Harden disk_free_space check in CheckSetupController
2 parents 0644eab + 061833b commit 9068bf5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

apps/settings/lib/Controller/CheckSetupController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ private function isCorrectMemcachedPHPModuleInstalled() {
379379
return true;
380380
}
381381

382-
// there are two different memcached modules for PHP
382+
// there are two different memcache modules for PHP
383383
// we only support memcached and not memcache
384384
// https://code.google.com/p/memcached/wiki/PHPClientComparison
385385
return !(!extension_loaded('memcached') && extension_loaded('memcache'));
@@ -392,7 +392,7 @@ private function isCorrectMemcachedPHPModuleInstalled() {
392392
*/
393393
private function isSettimelimitAvailable() {
394394
if (function_exists('set_time_limit')
395-
&& strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
395+
&& strpos(ini_get('disable_functions'), 'set_time_limit') === false) {
396396
return true;
397397
}
398398

@@ -819,12 +819,12 @@ protected function isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(): bool {
819819

820820
$tempPath = sys_get_temp_dir();
821821
if (!is_dir($tempPath)) {
822-
$this->logger->error('Error while checking the temporary PHP path - it was not properly set to a directory. value: ' . $tempPath);
822+
$this->logger->error('Error while checking the temporary PHP path - it was not properly set to a directory. Returned value: ' . $tempPath);
823823
return false;
824824
}
825-
$freeSpaceInTemp = disk_free_space($tempPath);
825+
$freeSpaceInTemp = function_exists('disk_free_space') ? disk_free_space($tempPath) : false;
826826
if ($freeSpaceInTemp === false) {
827-
$this->logger->error('Error while checking the available disk space of temporary PHP path - no free disk space returned. temporary path: ' . $tempPath);
827+
$this->logger->error('Error while checking the available disk space of temporary PHP path or no free disk space returned. Temporary path: ' . $tempPath);
828828
return false;
829829
}
830830

0 commit comments

Comments
 (0)