Regression: Multiple messages returned from the same update function aren't displayed

Created on 1 August 2010, about 14 years ago
Updated 19 November 2022, almost 2 years ago

Problem/Motivation

In #394268: DIE update_sql() DIE! β†’ a big cleanup of the update system was done which made it so update functions return a simple string (indicating a success message) rather than a complicated array like before.

However, some problems were introduced:

  1. We lost the ability for a single update function to return more than one message. There is already now code in core that tries to get around that via an ugly implode() - as shown (and fixed) in the attached patch. See also discussion in #774316: Remind users about new Drupal 8 features after migration from D7 β†’ which really could use that functionality.
  2. Similarly, an update function that gets called more than once (via a batch) has its initial return values ignored; only the last one is used.
  3. There is tons of code in update.php still designed to process the old method, and the result is that when update.php is finished we print a "list" of messages for each update function (using <li> tags) but the list can never have more than one element.

This patch cleans things up and restores the ability for an update function to return multiple messages either on a single pass or accumulated over multiple passes in a batch process.

Note: Drush probably requires some D7 changes as a result of this; I don't think that can be helped.

Steps to reproduce

Proposed resolution

TBA

Remaining tasks

Reroll patch
Add test, see #1 and #26

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Database updateΒ  β†’

Last updated 9 days ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States David_Rothstein

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024