Update settings from database

45 views
Skip to first unread message

paclo...@gmail.com

unread,
Jan 26, 2018, 12:50:22 PM1/26/18
to AtoM Users
Hi all -

I am attempting to configure the settings in AtoM (v2.4) via Ansible script, after the initial installation. So, I'd like to have a script that automatically sets the site title, default URL, and any other customized settings I want. I've been unsuccessful using SQL from the command line or using PHP from the symfony tools:run command.

I can connect to the MySQL atom database, locate the appropriate setting (in the setting_i18n table), and modify the value. However, at that point, AtoM doesn't seem to recognize the change in the database. For example, changing the value for the default repository browse view (id = 124) between 'card' and 'table' doesn't seem to affect that page as displayed in the browser (after reloading). I've tried clearing the cache and restarting both PHP-FPM and Nginx, but the edited setting isn't reflected in the UI.

If I browse to the AtoM Settings page, the edited value appears correctly. If I click the "Save" button from the Settings page, the edited value seems to take effect. Is there a way to trigger AtoM to re-read the settings from the database without the manual intervention of clicking the "Save" button?

An alternative I tried was to run a script via the symfony tools:run command. I modeled my script very closely on some of the migrations that introduced or changed settings (e.g. atom/lib/task/migrate/migrations/arMigration0124.class.php). I was unsuccessful in getting an external PHP script to change a setting. Is there a sample external PHP script that I can reference, to make sure I'm on the right track?

Any other suggestions or approaches?

Thanks for your help,
Paul

Dan Gillean

unread,
Jan 26, 2018, 1:23:27 PM1/26/18
to ICA-AtoM Users
Hi Paul, 

I will have to get one of our developers to take a look at this thread and see if they can point you in the right direction. Before I do so, let's rule out the easier options. 

I think it was wise to clear the application cache and restart PHP-FPM, but you might also want to restart memcached - another place where older page views are cached. Don't forget as well to clear your browser cache! 

To restart memcached: 
  • Ubuntu 14.04: sudo service memcached restart
  • Ubuntu 16.04: sudo systemctl restart memcached
In the meantime, I will see if I can get a developer to offer further suggestions. 

Regards, 

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-users+unsubscribe@googlegroups.com.
To post to this group, send email to ica-atom-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/8337747f-0ef5-4b40-9abd-945849e413b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dan Gillean

unread,
Jan 26, 2018, 1:26:42 PM1/26/18
to ICA-AtoM Users
PS, you might also want to check out the ansible scripts we use for deployment, in the following repositories, in case they are helpful: 

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

To post to this group, send email to ica-ato...@googlegroups.com.
Message has been deleted
Message has been deleted

Jim Adamson

unread,
Feb 1, 2018, 5:43:38 AM2/1/18
to ica-ato...@googlegroups.com
Hi Paul,

I've been working on a Puppet module for AtoM, and was trying to achieve something quite similar to you. The method I've employed is to build a vanilla instance of AtoM, set everything up through the UI (site title, etc, etc) then dump out the database with MySQLDump. Then I templatized (Ruby .erb file) the mysqldump file so that parameters for site title etc can be specified as class parameters in puppet and then the param values are interpolated in the generated mysqldump file when puppet runs. The end result is that I can create a new AtoM VM and have puppet import the mysqdump file as part of that, along with site title etc as specified in the puppet class parameters.

Anyway - one thing I've found useful along the way is to:
  • mysqldump out the setting_i18n table to a file
  • change relevant setting(s) via the UI
  • mysqldump out the setting_i18n table again to a different file
  • diff the two mysqldump files (I use TortoiseGitMerge for this)
Just thought I'd mention it as a way to verify that the SQL update you made to setting_i18n table using the MySQL client is correct and all that's needed in order to effect the intended change to settings.

Hope that helps.

Thanks, Jim

José Raddaoui

unread,
Feb 21, 2018, 1:46:32 PM2/21/18
to AtoM Users
Hi Paul and all,

There was only one step missing and Dan was in the right track but, depending on the instance, you may need to clear the PHP-APC cache instead of Mencached.

To do it via script executed with "symfony tools:run", you could do it like it's done when a settings form is saved through the GUI:


I hope that helps.
Reply all
Reply to author
Forward
0 new messages