DiskSpace.php in Automatic Updates 7
File
ReadinessCheckers/DiskSpace.php
View source
<?php
class DiskSpace implements ReadinessCheckerInterface {
const MINIMUM_DISK_SPACE = 10000000;
const MEGABYTE_DIVISOR = 1000000;
public static function run() {
return static::diskSpaceCheck();
}
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;
}
}