I want to setup a website using wordpress, which we can modified locally and then via subversion commit the site and make it public. This means to installing new plugins, changing the content, testing updates of wordpress to see if they work with the theme, etc.

The idea is to control the development on the site, in case we need to keep track of the dev or roll back, because of unexpected bugs in a the plugins, theme, etc.

I've read this article in codex, however I'm not sure how this is done when, we want to include the content and changes on the options of worpdress and plugins (which is in the mysql).


3 Answers 3


The codex article you linked would be what you would use to install / update the master copy of Wordpress locally. You then commit your changes to the Wordpress master site to a local svn repo.

What you could look at doing is implementing a commit hook to trigger based on a value in the commit message, or maybe when you commit into a tag. The hook script could then svn export a copy to the public host. Thus pushing live without all the extra svn files/folders.

The commit hook could also trigger the DB update, from what ever method you decide on to version control it.

Some svn hook reading: http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.reposadmin.create.hooks Also some stackoverflow Questions / Answers on hooks: https://stackoverflow.com/search?q=svn+hook


  • +1 for this. A post-commit hook would be the mostly tightly integrated (with svn) way of pushing your changes live, especially database alterations.
    – Beerey
    Mar 4, 2011 at 2:45

To do what you want you need to:

  1. figure out how to dump the parts of the database you want into a flat file (mysqldump or mysql-hotcopy may be of help here)
  2. automate doing so with a script (which you also put in version control)
  3. automote restoring said dump into the database in a script (which also goes into version control)

Then you've got all the pieces and can pull data from the db and check it into svn or push data from svn back into the db if/when you want to restore. Make sure to test that!


We do something similar with an automated Selenium-based integration testing system.

We have a PHP script on the server that listens for the remote call from a post-commit hook. The script performs an SVN update to update all the sources in the test environment (and then Selenium runs a number of predefined integration tests -- but you probably don't care about that).

For the database, you could call mysqldump via PHP to copy the dev database to live (automatically backing up the previous live of course).

Your Answer

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

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