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

Issue fork pathauto-3247809

Command icon 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

richard.walker.ardc created an issue. See original summary.

andregp’s picture

Assigned: Unassigned » andregp

I'll work on this.

andregp’s picture

Assigned: andregp » Unassigned
Status: Active » Needs review
StatusFileSize
new974 bytes
new991 bytes
new988 bytes
new252.35 KB
new251.6 KB
new252.11 KB

Here 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 A

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

Text C Running alias updates. Current entity: %label @id.
Text C

andregp’s picture

Issue tags: +Needs usability review
andregp’s picture

Status: Needs review » Needs work
Issue tags: -Needs usability review

After 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 checked or 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).

mably made their first commit to this issue’s fork.

mably’s picture

Status: Needs work » Needs review

Problem

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.

mably’s picture

Assigned: Unassigned » berdir
berdir’s picture

Assigned: berdir » Unassigned
Status: Needs review » Needs work

Reviewed, fine to merge when that's addressed I think

mably’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • mably committed b022484c on 8.x-1.x
    fix: #3247809 Notice of updated alias when there was no change
    
    By:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.