Running WordPress and Plugins from an SVN repository

Tags: ,

The process of installing/updating WordPress using Subversion is well documented, but keeping your entire WordPress installation in SVN is less-well documented, although there are several people who’ve also thought along these lines and have documented what they’ve done.

Here’s my take on it, very closely related to PB30’s method linked above, but with some enhancements…

svn mkdir http://svn.example.com/projects/wpblog -m "Creating blog directory"
mkdir blog
cd blog
svn co http://svn.example.com/projects/wpblog .
svn propset svn:externals . -F < (cat <

Edit the wp-config.php file and add your database configs, as well as the following three lines:

define('WP_CONTENT_DIR', realpath(ABSPATH.'../wp-content/'));
define('WP_CONTENT_URL', 'http://www.example.com/blog/wp-content');
define('WP_HOME', 'http://www.example.com/blog');

svn ci wp-config.php -m "Add database and wp-content settings"
cat <  .htaccess
# BEGIN WordPress

  RewriteEngine On
  # Base is the URL path of the home directory
  RewriteBase /blog/

  # Serve the main page
  RewriteRule ^$ core/index.php [L]
  # Serve real files and directories directly
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  # Serve uploads and plugins directly
  RewriteRule .* - [L]

  # And serve everything else from the core directory
  RewriteRule ^(.*)$ core/$1

  # Skip real files and directories
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  # Otherwise send it to WordPress
  RewriteRule .* core/index.php [L]

# END WordPress
EOF
svn add .htacess
svn ci .htaccess -m "Add .htaccess"
cd wp-content/plugins/
svn rm akismet
http://plugins.svn.wordpress.org/
svn propset svn:externals . -F < (cat <