Problem/Motivation
When running a bulk update, there may be a notice "Updated alias ..." generated that implies to the user that a particular node/term/user was updated. But in fact there may have been no such change.
Steps to reproduce
For example, using drush:
drush pag all all
> [notice] Updated alias for Content 26.
> [notice] Updated alias for Content 61.
> [notice] Updated alias for Content 86.
> [notice] Updated alias for Content 111.
> [notice] Updated alias for Content 137.
> [notice] Updated alias for Content 164.
> [notice] Updated alias for Content 189.
> [notice] Updated alias for Content 214.
> [notice] Updated alias for Content 215.
> [notice] Updated alias for Taxonomy term 12.
> [notice] Updated alias for User 34.
> [notice] Updated alias for User 48.
> [notice] Message: No new URL aliases to generate.
>
When I saw this, I thought that there had been updates to a dozen aliases. But no. I had a look at "Content 25", "User 34", etc., and found no change. On looking at the code (EntityAliasTypeBase.php) it seems that the message "Updated alias" is printed once at the end of each "batch" of 25 checks, whether or not anything was changed.
Proposed resolution
Change the wording of the notice to something closer to what has happened, e.g., "Batch completed ...", so that a (new) user doesn't think that those particular content/taxonomy term/user aliases were changed.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3247809_text_c.png | 252.11 KB | andregp |
| #3 | 3247809_text_b.png | 251.6 KB | andregp |
| #3 | 3247809_text_a.png | 252.35 KB | andregp |
| #3 | 3247809-2c.patch | 988 bytes | andregp |
| #3 | 3247809-2b.patch | 991 bytes | andregp |
Issue fork pathauto-3247809
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
andregp commentedI'll work on this.
Comment #3
andregp commentedHere are some options of fixes for this issue.
As the "best text" is subjective, and may vary depending on the user, I believe it will probably need more than 1 review.
Text A

Running alias update for Running alias update for %label @id.Text B

Batch completed. Running alias update for %label @id.Text C

Running alias updates. Current entity: %label @id.Comment #4
andregp commentedComment #5
andregp commentedAfter discussing with some other devs on the Drupal Usability Meeting 2022-01-21 we concluded the text should not only be shorter, but also represent better the progress of the function.
So, a line like "[current # of aliases]/[total # of aliases] aliases checked" like
25/128 aliases checkedor something similar would be the best approach.Unfortunately, I wasn't able to retrieve these values programmatically in order to display them on the terminal.
https://www.drupal.org/u/worldlinemine also suggested adding a verbose option so the default command wouldn't display so many lines, unless the verbose flag was added. (Although I believe it could be done on a separate issue as a feature request).
Comment #8
mably commentedProblem
During bulk alias updates, the batch progress message said "Updated alias for %label @id" on every iteration, regardless of whether an alias was actually changed. This gave site administrators the false impression that every entity's alias was being modified.
Fix
The message was changed to a neutral progress indicator: "Processing %label @id." — it simply reports which entity the batch is currently handling, without implying an alias was updated. The real update count is already tracked separately in
$context['results']['updates']and reported in the batch finished callback.Comment #9
mably commentedComment #10
berdirReviewed, fine to merge when that's addressed I think
Comment #11
mably commented