Slugs in Authority records

39 views
Skip to first unread message

Linda Justo

unread,
Nov 19, 2019, 11:01:25 PM11/19/19
to AtoM Users
Hello,
I have made changes to authority records (about 2 dozen) and now realise that the slugs haven't updated to the changed authorized form of name.  I am thinking I will have to create duplicate authority records, attach them their appropriate descriptions and then delete the incorrect authority records OR is there an easier way to do this?  
Regards
Linda

Dan Gillean

unread,
Nov 20, 2019, 10:43:20 AM11/20/19
to ICA-AtoM Users
Hi Linda, 

Fortunately, you're not the first person to ask this, so there is a way! 

If you have access to the command-line and know your MySQL credentials, then there is a way we could do this via a SQL query. If you are not the person responsible for installing and maintaining your AtoM instance, feel free to pass this message on to that person. 

Essentially, we can first use a SQL query to delete only the slugs associated with the authority records. Then we can use the slug generation command-line task to generate new slugs for those records, which will pull from the updated authorized forms of name. 

I have previously tested this query locally in my Vagrant box (against a 2.5 installation), but as always with scripts and queries shared in the user forum, this is shared as-is, and you should use it at your own risk. Please be sure to back up your data first, in case anything goes wrong

Here goes!

To use the query, we will first need to access the MySQL command prompt. To do that, we will need to know the MySQL username, password, and database name used during installation. If you can't recall for certain what credentials you used, you can always check in config/config.php - for example, to see this file you could run the following from the root AtoM installation directory, which should be /usr/share/nginx/atom if you have followed our recommended installation instructions: 
  • sudo nano config/config.php
You should see the database name and credentials listed near the top of the file. You can also check your database username and password in /root/.my.cnf like so:
  • sudo cat  /root/.my.cnf
Once you have the database name, MySQL user name, and password, we can use these to access the MySQL command prompt. Assuming in the following example that your database name is atom and your user and password are root, you could access the prompt like so: 
  • mysql -u root -proot atom;
Notice that there is a space between the -u and root, but NOT between the -p and the root password. Alternatively, you can leave no password following the -p, and you will be prompted to enter it by the command prompt before proceeding. 

At this point, we should have access to the MySQL command prompt, which should look like this: 

mysql>

We can now use a custom SQL query to target just the slugs of the authority records. You can find detailed instructions on the query in this previous forum thread, which also includes the steps to run the AtoM slug generation task after, and some follow-up maintenance tasks: 
Good luck, and let us know how it goes!

Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory


--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/d9682141-41bd-4379-8cf9-535609ef349e%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages