4

I see that Git and Wordpress are often discussed here, but I didn't find any answer to my specific question, so I'll open a new one.

Just to get a little familiar with git, I want to use it for my personal wordpress blog. My setup:

  • local Wordpress installation
  • remote repo (bitbucket)
  • automatic deployment everytime I push to bitbucket via FTP to my webhost (no chance installing git there, I use buddy)

So far its working fine, I can modify my stuff, write plugins etc and push it to the host. I wrote a small script to update my local dbs from time to time to have new comments etc. on my local installation, that works too.

But how do I handle plugin/wordpress core updates? Applying them directly to the production environment on my host would undermine the whole idea if git (i think), so I disabled automatic updates. But how to proceed?

  • Installing updates locally, committing and pushing them to the repo+host? What about db changes then? Do wordpress/plugin updates change something in the db? I guess they do?

  • Installing them on my host, then downloading everything via FTP, commit and push again (sounds redundant, and not really what I like to do)?

How do you handle this problem? Or is my setup completely wrong in some way?

1 Answer 1

4

I would formulate your requirements like this:

  • repository should capture complete and precise state of site
  • updates should be tested locally and pushed to production
  • database update events should run in production reliably

Sticking with Git alone that would indeed mean that you need to install updates locally and commit them into repository.

As for database updates WordPress core itself versions database structure and checks for it on boot. If database is outdated upon visiting site's admin you will be prompted to perform update. I think more busy sites often choose to override that behavior in favor of running it behind the scenes on demand instead.

This mostly leaves auditing specific plugins you use to check if they use custom database tables and such. It's not that common among WP extensions, most of them get by with native WP data structures and APIs.

As for possible improvement I would recommend to look into Composer and handling WP core as dependency. That would remove the need to keep copy of whole WP core in your repo.

3
  • Ok, thank you, I don't use that many plugins, so maybe I'll just update locally and push... Commented Oct 30, 2016 at 16:24
  • But thanks for the hint with composer, it is indeed not necessary to keep the whole wp core in my repo....ill look into that! Commented Oct 30, 2016 at 16:24
  • Thanks for this answer. Is there a way to trigger the activation hooks for the updated plugins to mimic the update_db functionality you describe for core? Thanks
    – ejntaylor
    Commented Jul 10, 2018 at 10:56

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.