You are here

protected function DiskSpaceValidator::freeSpace in Automatic Updates 8.2

Wrapper around the disk_free_space() function.

Parameters

string $path: The path for which to retrieve the amount of free disk space.

Return value

float The number of bytes of free space on the disk.

Throws

\RuntimeException If the amount of free space could not be determined.

1 call to DiskSpaceValidator::freeSpace()
DiskSpaceValidator::checkDiskSpace in src/Validator/DiskSpaceValidator.php
Checks that there is enough free space to perform automatic updates.

File

src/Validator/DiskSpaceValidator.php, line 54

Class

DiskSpaceValidator
Validates that there is enough free disk space to do automatic updates.

Namespace

Drupal\automatic_updates\Validator

Code

protected function freeSpace(string $path) : float {
  $free_space = disk_free_space($path);
  if ($free_space === FALSE) {
    throw new \RuntimeException("Cannot get disk information for {$path}.");
  }
  return $free_space;
}