Issue #3230235: Validate that an update is supported before an update begins and after staged
Merge request reports
Activity
added 3 commits
-
d8384b58...2a8779fe - 2 commits from branch
project:8.x-2.x
- 0555ffc0 - Initial attempt
-
d8384b58...2a8779fe - 2 commits from branch
added 3 commits
-
bf08a39f...b7ff1c56 - 2 commits from branch
project:8.x-2.x
- 0e887e95 - Merge branch '8.x-2.x' into 3230235-supported-begin
-
bf08a39f...b7ff1c56 - 2 commits from branch
- Resolved by Adam G-H
- Resolved by Adam G-H
- Resolved by Adam G-H
- Resolved by Adam G-H
- src/Event/UpdateVersionSubscriber.php 0 → 100644
10 11 /** 12 * Validates that core updates are within a supported version range. 13 */ 14 class UpdateVersionSubscriber implements EventSubscriberInterface { 15 16 use StringTranslationTrait; 17 18 /** 19 * Returns the running core version. 20 * 21 * @return string 22 * The running core version. 23 */ 24 protected function getCoreVersion(): string { 25 return \Drupal::VERSION; - Comment on lines +24 to +25
I see that adding this instead of directly accessing
Drupal::VERSION
allows us to test different versions for core. But I think we should stick with the same way the current update module is using to determine the core version, as well as all other projects, and to fake this for testing. We use this method in\Drupal\Tests\automatic_updates\Functional\UpdaterFormTest::setCoreVersion()
and we get the current version of core via$project['existing_version']
in\Drupal\automatic_updates\Form\UpdaterForm::buildForm()
That way we have 1 source of truth for the installed version of Drupal and 1 way of faking it for testing.
The one problem with this is that
update_get_available()
is needs to be called with$refresh = TRUE
to make sure we have the latest data. But we don't want every subscribed to have to have refresh the data.I am thinking that the updater should be responsible to for calling
update_get_available(TRUE)
. We could call it in\Drupal\automatic_updates\Updater::begin()
but it could take a while we might want to do this in something likeUpdater::prepare()
that we could add a separate batch step in\Drupal\automatic_updates\Form\UpdaterForm::submitForm()
.But I think for this issue we should actually just call
update_get_available(TRUE)
with a@todo
to figure this out.changed this line in version 7 of the diff
- Resolved by Adam G-H
mentioned in merge request !28