1

Question, then background behind the question:
We use Low Variables. When would the database overwrite our variable files on the server instead of the files overwriting what's in the database?

Background: Bitbucket had (is having) some issues. To push our sites from dev to staging we have a script that dumps the database, commits and pushes to our dev branch, merges with our staging and then pushes our staging, then checks the dev branch back out so that we are always on dev, the database that was dumped is then imported into the staging database.

This typically works great, except what seems to have happened yesterday is that our script pushed our dev branch, however since was Bitbucket was having issues, it seems that when we checked the dev branch back out it checked out an old commit. In hindsight there were a lot of things we could have done (gone through our local git -log, etc), however did I mention that this was a site for a local college and we were presenting it to the faculty 3 hours after this happen?

So it seems that when that happened, and we then ran the site, that ExpressionEngine took what was in the variable files and overwrote what was in our database. This is typically what I would expect. However after we pulled in all the files from the backup from the previous night (actual nightly file and database backups we run, not git), it seemed that the database was then overwriting our variables. We knew that the files were good (again, in hind-sight I should have reverted the database as well), however when we looked at the variables in EE and then the actual files they were bad. It was until I pulled the backup files into a non-EE folder, then manually copied the text from one into the files in the EE install that the files saved correctly and the proper variable files were in EE.

Also, it seems that only the variables were over written, not any templates. I'm just trying to understand what could have happened and how / when the whole syncing process works.

thanks

In Hindsight:
- we should have done a full restore from the files/database backup to nip this in the butt
- we should have looked at our local git repository for the log and what was committed before instead of just relying on Bitbucket
- I've repeatedly stated that we shouldn't be making changes the day of presentations. Once again I got vetoed.

1 Answer 1

2

Low Variables variable syncing works like this. Note that each time you save a LV in the Control Panel, its DB edit date is updated:

  • Vars marked save as file are fetched from the DB;
  • Variable directory is created if not there;
  • For each file in the DB, LV checks if the file is there;
  • If not, the file is created;
  • If the file is there, the date is checked (using CI's get_file_info function);
  • If the file date is newer than the DB edit date, the DB is updated;
  • If the file date is older than the DB edit date, the file is updated;
  • Any non-existing var-files are deleted.

To avoid any unexpected behaviour, you can choose to enable one way sync, which will only ever update the DB from files (so changes made via the CP won't update the files). This setting is also available as a config override.

1
  • thanks! I didn't realize it was checking the date (of course, makes perfect sense). That explains exactly what we experienced and how the chain reaction happened. Commented Feb 24, 2015 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.