If I check three nodes I would like updated and use the "Update URL Alias" feature from the admin/content page, I get a happy green message that says Updated URL aliases for 3 nodes. but often no aliases were updated. There is no indication why.

In fact, there could be several reasons:

  1. The Update action in pathauto settings could be set to Do nothing. Leave the old alias intact.
  2. The node could have the Generate automatic URL alias box unchecked
  3. The node (or entity) type could have no pattern defined.
  4. The alias was already using the current pattern

The messaging on the bulk update page should tell me how many aliases were *actually* updated. It would be even better if it also told me why the other aliases were not updated.

It will be hard to get a count for #4, since it looks like the update function overwrites what's in the database even if the values are identical, so I'll shoot for the other three.

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

jenlampton’s picture

Title: Bulk Operations messaging needs to be accurate » Bulk Update messaging lies
jenlampton’s picture

Issue summary: View changes
jenlampton’s picture

Status: Active » Needs review
FileSize
1.92 KB
PASSED: [[SimpleTest]]: [MySQL] 322 pass(es). View

Here's a first attempt at a patch to add some friendly and useful messaging for bulk updates.

jenlampton’s picture

FileSize
2.04 KB
FAILED: [[SimpleTest]]: [MySQL] 313 pass(es), 4 fail(s), and 0 exception(s). View

Well, that's not right. Trying again.

Status: Needs review » Needs work

The last submitted patch, 4: pathauto-accurate_update_counts-2235557-2.patch, failed testing.

jenlampton’s picture

Issue summary: View changes
jenlampton’s picture

Status: Needs work » Needs review
FileSize
2.01 KB
PASSED: [[SimpleTest]]: [MySQL] 322 pass(es). View

This time with no debug messages.

jenlampton’s picture

FileSize
2.66 KB
PASSED: [[SimpleTest]]: [MySQL] 322 pass(es). View

And one more to catch the last non-update case.

Daniel_Rose’s picture

Status: Needs review » Reviewed & tested by the community

Hi Jen! I realize that this is 3 years old but I happened to be in the pathauto issue queue while I update this module at work. I was having an issue with "Bulk Generate" not working so I was trying "Update URL alias" to see if that worked. I was getting the same thing you were, "Updated x number of nodes" but nothing worked. With this patch, I am able to see that the url aliases updated.

I also tested this with having the "Do nothing..." option checked and it returned "Skipped x number of nodes because "Do nothing." is checked" So it seems like this works well. Would be neat to get this into a release.

Thanks. :)

Daniel_Rose’s picture

I just wanted to reference this issue here as well. #2770217: Bulk generate does no work in Drupal 7.50. Seems like the "Bulk Generate" feature would benefit from some more descriptive text in it's returned message as well. Just a thought.

darrenwh’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/pathauto.module
@@ -590,13 +590,55 @@ function pathauto_node_update_alias(stdClass $node, $op, array $options = array(
+    if ($updated > 0) {
+      drupal_set_message(format_plural($updated, 'Updated URL alias for 1 node.', 'Updated URL aliases for @count nodes.'));
+    }
+    if ($not_automatic > 0) {
+      drupal_set_message(format_plural($not_automatic, 'Skipped 1 node because its alias was not automaticly generated.', 'Skipped @count nodes because their aliases were not automaticly generated.'));
+    }
+    if ($patternless > 0) {
+      drupal_set_message(format_plural($patternless, 'Skipped 1 node because it did not have an alias pattern.', 'Skipped @count nodes because they did not have an alias pattern.'));
+    }
+    if ($action_do_nothing > 0) {
+      drupal_set_message(format_plural($action_do_nothing, 'Skipped 1 node because update action is set to <em>Do nothing</em>.', 'Skipped @count nodes because update action is set to <em>Do nothing</em>.'));
+    }
   }

I think the message text needs to wrapped in t()

Daniel_Rose’s picture

I'll update the patch later tonight, if that's cool? Looks like a nice learning opportunity.

Daniel_Rose’s picture

Added the t() around the drupal_set_message message text. This works, but is this what you meant?

Status: Needs review » Needs work

The last submitted patch, 13: pathauto-accurate_update_counts-2235557-13.patch, failed testing.

The last submitted patch, 13: pathauto-accurate_update_counts-2235557-13.patch, failed testing.

Daniel_Rose’s picture

Added t() around all of the messages instead of the entire section. Still works this way when testing, but lets see if it fails again on here.