You are here

protected static function DiskSpace::diskSpaceCheck in Automatic Updates 7

Check if the filesystem has sufficient disk space.

Return value

array An array of translatable strings if there is not sufficient space.

1 call to DiskSpace::diskSpaceCheck()
DiskSpace::run in ReadinessCheckers/DiskSpace.php
Run check.

File

ReadinessCheckers/DiskSpace.php, line 31

Class

DiskSpace
Disk space checker.

Code

protected static function diskSpaceCheck() {
  $messages = [];
  if (disk_free_space(DRUPAL_ROOT) < static::MINIMUM_DISK_SPACE) {
    $messages[] = t('Logical disk "@root" has insufficient space. There must be at least @space megabytes free.', [
      '@root' => DRUPAL_ROOT,
      '@space' => static::MINIMUM_DISK_SPACE / static::MEGABYTE_DIVISOR,
    ]);
  }
  $temp = drupal_realpath('temporary://');
  if (disk_free_space($temp) < static::MINIMUM_DISK_SPACE) {
    $messages[] = t('Directory "@temp" has insufficient space. There must be at least @space megabytes free.', [
      '@temp' => $temp,
      '@space' => static::MINIMUM_DISK_SPACE / static::MEGABYTE_DIVISOR,
    ]);
  }
  return $messages;
}