function DiskSpaceValidator::freeSpace

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::validate in core/modules/package_manager/src/Validator/DiskSpaceValidator.php
Validates that there is enough free disk space to do stage operations.

File

core/modules/package_manager/src/Validator/DiskSpaceValidator.php, line 42

Class

DiskSpaceValidator
Validates that there is enough free disk space to do stage operations.

Namespace

Drupal\package_manager\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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.