Drupal - Bulk update for unchecked "Generate automatic URL alias"

Have you tried using Views Bulk Operation. All you will need to do is create a view that will list all the nodes that will meet your criteria and then assign an action 'Generate Url alias' (I haven't tried it though.)


VBO doesn't have an option to change the status of 'Generate automatic URL alias'

You could execute the following mysql query:

UPDATE `pathauto_state` SET `pathauto`=1 WHERE `entity_type` = 'node'

Or if you want to update just exact content type only:

UPDATE  `pathauto_state` p, `node` n SET `pathauto` = 1 WHERE
p.entity_id = n.nid and n.type = 'mycustontype'

where 'mycustomtype' is a machine name of the content type.

Or if you have drush installed:

drush sqlq "UPDATE pathauto_state SET pathauto=1 WHERE entity_type = 'node'"

After that you can bulk generate the new paths as you would normaly do on: admin/config/search/path/update_bulk


In addition to Rick B's answer, you will also need to create entries for the nodes that have never had that checked. That can be accomplished running this query:

INSERT INTO pathauto_state
SELECT 'node',n.nid ,1
FROM node n
WHERE n.type = 'api'
AND n.nid NOT IN (SELECT entity_id FROM pathauto_state)

which can be run either using drush on directly on the database as Rick described.

For taxonomy terms, determine your term's vocabulary id (3 in the example below) and do a similar insert:

INSERT INTO pathauto_state
SELECT 'taxonomy_term', t.tid, 1
FROM taxonomy_term_data t
WHERE t.vid = 3
AND t.tid NOT IN (SELECT entity_id FROM pathauto_state)

Tags:

7

Path Aliases