diff --git a/core/modules/auto_updates/auto_updates.install b/core/modules/auto_updates/auto_updates.install index 600babcf92..1c9a1306fe 100644 --- a/core/modules/auto_updates/auto_updates.install +++ b/core/modules/auto_updates/auto_updates.install @@ -27,7 +27,9 @@ function auto_updates_requirements($phase) { $last_check_timestamp = $checker_manager->getTimestamp(); if ($last_check_timestamp === NULL) { $requirements['auto_updates_readiness']['severity'] = REQUIREMENT_ERROR; - $requirements['auto_updates_readiness']['value'] = t('Your site has never checked if it is ready to apply automatic updates.', [':readiness_checks' => 'https://www.drupal.org/docs/8/update/automatic-updates#readiness-checks']); + // @todo Link "automatic updates" to documentation in + // https://www.drupal.org/node/3168405. + $requirements['auto_updates_readiness']['value'] = t('Your site has never checked if it is ready to apply automatic updates.'); if ($readiness_check->access()) { $requirements['auto_updates_readiness']['description'] = t('Run readiness checks manually.', [ ':link' => $readiness_check->toString(), @@ -37,7 +39,9 @@ function auto_updates_requirements($phase) { elseif (!$checker_manager->hasRunRecently()) { $requirements['auto_updates_readiness']['severity'] = REQUIREMENT_ERROR; $time_ago = \Drupal::service('date.formatter')->formatTimeDiffSince($last_check_timestamp); - $requirements['auto_updates_readiness']['value'] = t('Your site has not recently checked if it is ready to apply automatic updates.', [':readiness_checks' => 'https://www.drupal.org/docs/8/update/automatic-updates#readiness-checks']); + // @todo Link "automatic updates" to documentation in + // https://www.drupal.org/node/3168405. + $requirements['auto_updates_readiness']['value'] = t('Your site has not recently checked if it is ready to apply automatic updates.'); if ($readiness_check->access()) { $requirements['auto_updates_readiness']['description'] = t('Readiness checks were last run @time ago. Run readiness checks manually.', [ '@time' => $time_ago, @@ -63,7 +67,9 @@ function auto_updates_requirements($phase) { else { $requirements['auto_updates_readiness'] += [ 'severity' => REQUIREMENT_OK, - 'value' => t('Your site is ready for automatic updates.', [':readiness_checks' => 'https://www.drupal.org/docs/8/update/automatic-updates#readiness-checks']), + // @todo Link "automatic updates" to documentation in + // https://www.drupal.org/node/3168405. + 'value' => t('Your site is ready for automatic updates.'), ]; } } diff --git a/core/modules/auto_updates/auto_updates.module b/core/modules/auto_updates/auto_updates.module index b75d246926..3bb1cad5a5 100644 --- a/core/modules/auto_updates/auto_updates.module +++ b/core/modules/auto_updates/auto_updates.module @@ -42,14 +42,18 @@ function auto_updates_page_top(array &$page_top) { } $results = $checker_manager->getResults(ReadinessCheckerManagerInterface::ERROR); if ($results) { - \Drupal::messenger()->addError(t('Your site is currently failing readiness checks for automatic updates. It cannot be automatically updated until further action is performed.', [':readiness_checks' => 'https://www.drupal.org/docs/8/update/auto-updates#readiness-checks'])); + // @todo Link "automatic updates" to documentation in + // https://www.drupal.org/node/3168405. + \Drupal::messenger()->addError(t('Your site is currently failing readiness checks for automatic updates. It cannot be automatically updated until further action is performed.')); foreach ($results as $message) { \Drupal::messenger()->addError($message); } } $results = $checker_manager->getResults(ReadinessCheckerManagerInterface::WARNING); if ($results) { - \Drupal::messenger()->addWarning(t('Your site does not pass some readiness checks for automatic updates. Depending on the nature of the failures, it might effect the eligibility for automatic updates.', [':readiness_checks' => 'https://www.drupal.org/docs/8/update/auto-updates#readiness-checks'])); + // @todo Link "automatic updates" to documentation in + // https://www.drupal.org/node/3168405. + \Drupal::messenger()->addWarning(t('Your site does not pass some readiness checks for automatic updates. Depending on the nature of the failures, it might effect the eligibility for automatic updates.')); foreach ($results as $message) { \Drupal::messenger()->addWarning($message); } diff --git a/core/modules/auto_updates/src/Controller/ReadinessCheckerController.php b/core/modules/auto_updates/src/Controller/ReadinessCheckerController.php index 4381d05918..c2bb521490 100644 --- a/core/modules/auto_updates/src/Controller/ReadinessCheckerController.php +++ b/core/modules/auto_updates/src/Controller/ReadinessCheckerController.php @@ -54,7 +54,9 @@ public static function create(ContainerInterface $container) { */ public function run() { if (!array_filter($this->checkerManager->run())) { - $this->messenger()->addStatus($this->t('No issues found. Your site is ready for automatic updates.', [':readiness_checks' => 'https://www.drupal.org/docs/8/update/auto-updates#readiness-checks'])); + // @todo Link "automatic updates" to documentation in + // https://www.drupal.org/node/3168405. + $this->messenger()->addStatus($this->t('No issues found. Your site is ready for automatic updates')); } return $this->redirect('auto_updates.settings'); } diff --git a/core/modules/auto_updates/src/ReadinessChecker/DiskSpace.php b/core/modules/auto_updates/src/ReadinessChecker/DiskSpace.php index ea5a25c831..b97695900e 100644 --- a/core/modules/auto_updates/src/ReadinessChecker/DiskSpace.php +++ b/core/modules/auto_updates/src/ReadinessChecker/DiskSpace.php @@ -10,12 +10,12 @@ class DiskSpace extends FileSystemBase { /** - * Minimum disk space (in bytes) is 100 MB. + * Minimum disk space (in bytes) is 1 GB. * * @todo Determine how much the minimum should be now that we will be using * Composer in https://www.drupal.org/node/3166416. */ - const MINIMUM_DISK_SPACE = 100000000; + const MINIMUM_DISK_SPACE = 1073741824; /** * Megabyte divisor. @@ -29,13 +29,15 @@ protected function doCheck(): array { $messages = []; $minimum_megabytes = static::MINIMUM_DISK_SPACE / static::MEGABYTE_DIVISOR; if (!$this->areSameLogicalDisk($this->getRootPath(), $this->getVendorPath())) { - if (disk_free_space($this->getRootPath()) < static::MINIMUM_DISK_SPACE) { + // If the root and vendor paths are not on the same logical disk check + // that each have at least half of the minimum required disk space. + if (disk_free_space($this->getRootPath()) < (static::MINIMUM_DISK_SPACE / 2)) { $messages[] = $this->t('Drupal root filesystem "@root" has insufficient space. There must be at least @space megabytes free.', [ '@root' => $this->getRootPath(), '@space' => $minimum_megabytes, ]); } - if (disk_free_space($this->getVendorPath()) < static::MINIMUM_DISK_SPACE) { + if (disk_free_space($this->getVendorPath()) < (static::MINIMUM_DISK_SPACE / 2)) { $messages[] = $this->t('Vendor filesystem "@vendor" has insufficient space. There must be at least @space megabytes free.', [ '@vendor' => $this->getVendorPath(), '@space' => $minimum_megabytes, @@ -48,13 +50,6 @@ protected function doCheck(): array { '@space' => $minimum_megabytes, ]); } - $temp = FileSystemComponent::getOsTemporaryDirectory(); - if (disk_free_space($temp) < static::MINIMUM_DISK_SPACE) { - $messages[] = $this->t('Directory "@temp" has insufficient space. There must be at least @space megabytes free.', [ - '@temp' => $temp, - '@space' => $minimum_megabytes, - ]); - } return $messages; } diff --git a/core/modules/auto_updates/tests/src/Kernel/ReadinessChecker/DiskSpaceTest.php b/core/modules/auto_updates/tests/src/Kernel/ReadinessChecker/DiskSpaceTest.php index b4d0264e0a..e1c7dd0f3f 100644 --- a/core/modules/auto_updates/tests/src/Kernel/ReadinessChecker/DiskSpaceTest.php +++ b/core/modules/auto_updates/tests/src/Kernel/ReadinessChecker/DiskSpaceTest.php @@ -31,17 +31,15 @@ public function testDiskSpace() { // Out of space. $disk_space = new TestDiskSpace($this->container->getParameter('app.root')); $messages = $disk_space->run(); - $this->assertCount(2, $messages); + $this->assertCount(1, $messages); $this->assertStringMatchesFormat('Logical disk "%s" has insufficient space. There must be at least %s megabytes free.', (string) $messages[0]); - $this->assertStringMatchesFormat('Directory "%s" has insufficient space. There must be at least %s megabytes free.', (string) $messages[1]); // Out of space not the same logical disk. $disk_space = new TestDiskSpaceNonSameDisk($this->container->getParameter('app.root')); $messages = $disk_space->run(); - $this->assertCount(3, $messages); + $this->assertCount(2, $messages); $this->assertStringMatchesFormat('Drupal root filesystem "%s" has insufficient space. There must be at least %s megabytes free.', (string) $messages[0]); $this->assertStringMatchesFormat('Vendor filesystem "%s" has insufficient space. There must be at least %s megabytes free.', (string) $messages[1]); - $this->assertStringMatchesFormat('Directory "%s" has insufficient space. There must be at least %s megabytes free.', (string) $messages[2]); // Web root and vendor path are invalid. $disk_space = new DiskSpace("if_there_was_ever_a_folder_with_this_path_this_test_would_fail");