Skip to content
Snippets Groups Projects

Issue #3248928: Redirect or provide link to apply form for user who started update if accessing start form

Merged Issue #3248928: Redirect or provide link to apply form for user who started update if accessing start form
All threads resolved!
All threads resolved!
+ 12
10
@@ -114,8 +114,10 @@ class UpdaterForm extends FormBase {
public function buildForm(array $form, FormStateInterface $form_state) {
$this->messenger()->addWarning($this->t('This is an experimental Automatic Updater using Composer. Use at your own risk.'));
$stage_exists = FALSE;
if (!$this->updater->isAvailable()) {
if ($this->updater->isAvailable()) {
$stage_exists = FALSE;
}
else {
$stage_exists = TRUE;
// If there's a stage ID stored in the session, try to claim the stage
@@ -130,17 +132,11 @@ class UpdaterForm extends FormBase {
]);
}
catch (StageException $e) {
// We already know a staging exists, even if it's not ours, so we
// don't have to do anything else here.
// We already know a stage exists, even if it's not ours, so we don't
// have to do anything else here.
}
}
}
// If the form has been submitted, do not display this error message because
// ::deleteExistingUpdate() may run on submit. The message will still be
// displayed on form build if needed.
if ($stage_exists && !$form_state->getUserInput()) {
$this->messenger()->addError($this->t('Cannot begin an update because another Composer operation is currently in progress.'));
}
$form['last_check'] = [
'#theme' => 'update_last_check',
@@ -252,6 +248,12 @@ class UpdaterForm extends FormBase {
$this->displayResults($results, $this->messenger());
if ($stage_exists) {
// If the form has been submitted, do not display this error message
// because ::deleteExistingUpdate() may run on submit. The message will
// still be displayed on form build if needed.
if (!$form_state->getUserInput()) {
$this->messenger()->addError($this->t('Cannot begin an update because another Composer operation is currently in progress.'));
}
$form['actions']['delete'] = [
'#type' => 'submit',
'#value' => $this->t('Delete existing update'),
Loading