Skip to content
Snippets Groups Projects
Commit a7e2c9d0 authored by Yash Rode's avatar Yash Rode Committed by Adam G-H
Browse files

Issue #3313349 by yash.rode, phenaproxima: Possible DB updates are displayed...

Issue #3313349 by yash.rode, phenaproxima: Possible DB updates are displayed twice on UpdateReady form
parent 7058c0a0
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,6 @@ use Drupal\automatic_updates\BatchProcessor;
use Drupal\automatic_updates\Updater;
use Drupal\automatic_updates\Validation\ReadinessTrait;
use Drupal\package_manager\ValidationResult;
use Drupal\package_manager\Validator\StagedDBUpdateValidator;
use Drupal\Core\Batch\BatchBuilder;
use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\Core\Form\FormBase;
......@@ -55,13 +54,6 @@ final class UpdateReady extends FormBase {
*/
protected $moduleList;
/**
* The staged database update validator service.
*
* @var \Drupal\package_manager\Validator\StagedDBUpdateValidator
*/
protected $stagedDatabaseUpdateValidator;
/**
* The renderer service.
*
......@@ -87,19 +79,16 @@ final class UpdateReady extends FormBase {
* The state service.
* @param \Drupal\Core\Extension\ModuleExtensionList $module_list
* The module list service.
* @param \Drupal\package_manager\Validator\StagedDBUpdateValidator $staged_database_update_validator
* The staged database update validator service.
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer service.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* Event dispatcher service.
*/
public function __construct(Updater $updater, MessengerInterface $messenger, StateInterface $state, ModuleExtensionList $module_list, StagedDBUpdateValidator $staged_database_update_validator, RendererInterface $renderer, EventDispatcherInterface $event_dispatcher) {
public function __construct(Updater $updater, MessengerInterface $messenger, StateInterface $state, ModuleExtensionList $module_list, RendererInterface $renderer, EventDispatcherInterface $event_dispatcher) {
$this->updater = $updater;
$this->setMessenger($messenger);
$this->state = $state;
$this->moduleList = $module_list;
$this->stagedDatabaseUpdateValidator = $staged_database_update_validator;
$this->renderer = $renderer;
$this->eventDispatcher = $event_dispatcher;
}
......@@ -120,7 +109,6 @@ final class UpdateReady extends FormBase {
$container->get('messenger'),
$container->get('state'),
$container->get('extension.list.module'),
$container->get('package_manager.validator.staged_database_updates'),
$container->get('renderer'),
$container->get('event_dispatcher')
);
......@@ -144,23 +132,6 @@ final class UpdateReady extends FormBase {
$messages = [];
// If there are any installed extensions with database updates in the
// staging area, warn the user that they might be sent to update.php once
// the staged changes have been applied.
$pending_updates = $this->stagedDatabaseUpdateValidator->getExtensionsWithDatabaseUpdates($this->updater);
if ($pending_updates) {
natcasesort($pending_updates);
$message_item_list = [
'#theme' => 'item_list',
'#prefix' => '<p>' . $this->t('Possible database updates were detected in the following extensions; you may be redirected to the database update page in order to complete the update process.') . '</p>',
'#items' => $pending_updates,
'#context' => [
'list_style' => 'automatic-updates__pending-database-updates',
],
];
$messages[MessengerInterface::TYPE_WARNING][] = $this->renderer->renderRoot($message_item_list);
}
try {
$staged_core_packages = $this->updater->getStageComposer()
->getCorePackages();
......
......@@ -566,14 +566,9 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
// Ensure that a list of pending database updates is visible, along with a
// short explanation, in the warning messages.
$possible_update_message = 'Possible database updates were detected in the following extensions; you may be redirected to the database update page in order to complete the update process.';
$warning_messages = $assert_session->elementExists('xpath', '//div[@data-drupal-messages]//div[@aria-label="Warning message"]');
$this->assertStringContainsString($possible_update_message, $warning_messages->getText());
$pending_updates = $warning_messages->findAll('css', 'ul.item-list__automatic-updates__pending-database-updates li');
$this->assertCount(2, $pending_updates);
$this->assertSame('Automatic Updates Theme With Updates', $pending_updates[0]->getText());
$this->assertSame('System', $pending_updates[1]->getText());
$possible_update_message = 'Possible database updates have been detected in the following extensions.<ul><li>System</li><li>Automatic Updates Theme With Updates</li></ul>';
$warning_messages = $assert_session->elementExists('css', 'div[data-drupal-messages] div[aria-label="Warning message"]');
$this->assertStringContainsString($possible_update_message, $warning_messages->getHtml());
if ($maintenance_mode_on === TRUE) {
$assert_session->fieldNotExists('maintenance_mode');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment