Skip to content

Commit e31ef9e

Browse files
committed
Added security check when calling disk_*_space functions as they are often disabled
1 parent e04379e commit e31ef9e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

includes/src/Traits/Shared/FsUtils.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,12 @@ public function getDirRegexStats($dir, $regex = '', $include_paths = false, $che
317317
unset($_resource, $_resource_sub_path, $_resource_basename); // Housekeeping.
318318

319319
if ($check_disk) { // Check disk also?
320-
$stats['disk_total_space'] = disk_total_space($dir);
321-
$stats['disk_free_space'] = disk_free_space($dir);
320+
if( $this->functionIsPossible('disk_total_space')) {
321+
$stats['disk_total_space'] = disk_total_space($dir);
322+
}
323+
if( $this->functionIsPossible('disk_free_space')) {
324+
$stats['disk_free_space'] = disk_free_space($dir);
325+
}
322326
}
323327
return $stats;
324328
}

0 commit comments

Comments
 (0)