Configuration 1: I created the following patterns:

articles ct (via selecting Content): articles/[node:title]
basic page (via selecting Content): [node:menu-link:parent]/[node:menu-link]
forum topic (via selecting Forum): [term:vocabulary]/[term:parent]/[term:name]

Test 1: run url alias generator
Result test 1:
-- basic page set to menu got an alias - node/2 became /about-us
-- none of the six articles got an alias
-- none of the two forum topic items got an alias
-- observed that "Generate automatic URL alias" was not available for individual forum topics

Configuration 2: change forum topic pattern strategy

I created forum/[node:taxonomy_forums]/[node:title] as a content pattern

Test 2: run url alias generator
Result test 2:
-- one of three possible forum topic aliases generated.
-- I checked to see if the "generate automatic url alias" was now there, and it is.
-- I created a test forum topic again, got the alias.

Test 3: run alias update from /admin/content using 'with selection' for selected article nodes
Results test 3:
-- aliases were generated for selected articles

Summary of issues found:
-- generator not working consistently
-- Using Forum patterns don't connect to the forum topic (as designed?)

Comments

idcm created an issue. See original summary.

suresh.senthatti’s picture

I have created path alias by custom code dynamically, sometime when i update the path alias(corresponding nodes), path alias are getting deleted and its not created newly as well.

Is anybody know why path alias are getting deleted automatically?

jonnyeom’s picture

It may be that the content has the Generate automatic URL alias checkbox unchecked.
This options is under the URL Path Settings.
I simply had to go to /admin/content and update the url aliases.

RogerB’s picture

Title: aliases not generating » Mass update of URL alias checkbox

I seems that when pathauto/patterns are enabled on a site with existing content then the Generate URL alias flag is unchecked on that content. As @jonnyeom says above this can be fixed for nodes on /admin/content. However if you have lots of content, or if it is another entity type such as taxonomy_terms, it is not easy to fix this issue.

In my case I had several hundred taxonomy terms for which path aliases were not being generated. After hunting around a bit in the code I discovered that the generate url alias flag is held in the key_value table. In this table these records are identified by having a collection column value of pathauto_state.entity-type. The name column value is the entity id. The value column, a blob, holds the true/false setting for the entity instance as a serialised integer.

So this SQL sets the generate url flag for all existing taxonomy terms to true.

UPDATE `key_value` SET value ='i:1;' WHERE collection = 'pathauto_state.taxonomy_term';

Obviously you can join this table on the name column to the node table if you want to target entity specific bundles.

LpSolit’s picture

Status: Active » Closed (duplicate)

The initial issue is a bit too vague to know exactly what's going on. Also, it mentions nodes and forums, and then a subsequent comment is about taxonomy terms, which is not part of the initial issue. Problems described here are already covered in other issues, especially issue #2778785, so I'm marking this one as a duplicate.

diegoj86’s picture

For those wanting to do a mass update in the DB, you need to look at the drupal_pathauto_state (maybe without the drupal_ prefix) table.

For example:

UPDATE `drupal_pathauto_state`
SET pathauto = 1
WHERE entity_id = 5

Or to update all checks for a specific content type,

UPDATE `drupal_pathauto_state`
SET pathauto = 1
WHERE entity_id IN (SELECT nid 
                    FROM drupal_node
                    WHERE `type` = 'article')

Hope this helps anyone!

dqd’s picture

The user who marked this is issue as duplicate forgot to link to the former issue he is referring to: #2778785: Taxonomy Terms do not Bulk Generate

Apart from that, the issue is discussed on several places and NOT a terms only issue. It doesn't matter if one user describes his expereinces with terms. Others describe it on nodes created before pathalias has been set up for this type. And it persists on all entity types. The more important question is, how we solve it system-wide in the best and the most convinent way to not run in other issues with it. The often stated examples to run SQL commands should maybe become a starting point to implement it to pathauto. The 2nd question is: should it be optional or should it be the defacto default. Optional means we need new setting form elements implemented to set up pathauto under Bulk generate. For me the "Bulk generate" functionality suggerates that ALL items under given entity types chosen and set up in patterns should be affected. Not only the new ones. Otherwise Bulk generate is somewhat meaningless. But maybe it's just my understanding. We also should take care and a look at a redirect implementation since this means also that the paths ar enot reachable no more. On biggfer projeects this could become an issue, especially since we now change the behaviour of pathauto.

dqd’s picture

zpopic’s picture

There is also PHP way to update checkbox state.
The example below is for commerce product entity mass update to checked.
$key represents id of entity, so you can perform additional filtering if you want.

$keyValue = \Drupal::keyValue('pathauto_state.commerce_product');

$checkboxStates = $keyValue->getAll();

foreach($checkboxStates as $key => $checkboxState) {
  $keyValue->set($key, 1);
}
dqd’s picture

@zpopic #9 While it is kind of you to take the time to post your personal work-around and share it with others, let me add for consideration that we should take care about such dangerous suggestions readed by users and maybe used in the wrong hands. And we shouldn't post them in the official issues where it is about to fix the real problem in the project/module/contrib. Your interjection will raise noise about if your work-around is working or not and users will cross post here about it maybe (happens often) and this will ping the maintainers, helpers and patch providers every time. Thanks for understanding.

But if you like to contribute to the docs of drupal.org with such ideas, feel free to add your hint in the docs. There are very helpful community members and docs maintainers who can help to find the right place for it.

Apart form that - this issue is closed in favour of #2778785: Taxonomy Terms do not Bulk Generate