Unfortunately at this time, other than the --delete option, there are no further configuration options available for the generate-slugs task. Using SQL is likely the only way to go at present.
I have tested out this query in my local test instance and it seems to work well. However as always, proceed at your own risk, and I strongly recommend you make a backup of your data before proceeding, just in case!
You can run it as a SELECT first, to review the slugs listed, and to check the count against the number of authority records you have to make sure that nothing else is being pulled in:
- SELECT slug FROM slug INNER JOIN actor ON actor.id = slug.object_id INNER JOIN object o ON actor.id=o.id WHERE o.class_name='QubitActor' AND actor.parent_id IS NOT NULL;
Some notes on this, so you know what it's doing:
- The actor table is also used by user accounts and repository records. By joining on the object table and using the WHERE clause to limit it to those entities that have a class of QubitActor, we are ensuring that only authorities are affected
- the actor.parent_id IS NOT NULL at the end is to ensure that we don't delete the root actor record's slug - all other actors have this actor's ID listed as the parent ID in the database.
If the output of the select looks good and matches your count of authorities, then you can run the same query again as a DELETE rather than a SELECT:
- DELETE slug FROM slug INNER JOIN actor ON actor.id = slug.object_id INNER JOIN object o ON actor.id=o.id WHERE o.class_name='QubitActor' AND actor.parent_id IS NOT NULL;
You can then use the slug generation task - don't use the --delete option, as we have already deleted the slugs we want to update! If you do, AtoM will delete ALL slugs and replace them.
- php symfony propel:generate-slugs
Remember that after running the task, you'll want to rebuild the search index:
- php symfony search:populate
You may want to clear your caches as well to ensure they are up to date. Commands for PHP 7.2 in Ubuntu 18.04:
- php symfony cc
- sudosystemctl restart php7.2-fpm