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 -m "Creating blog directory"
mkdir blog
cd blog
svn co .
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', '');
define('WP_HOME', '');

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
svn add .htacess
svn ci .htaccess -m "Add .htaccess"
cd wp-content/plugins/
svn rm akismet
svn propset svn:externals . -F < (cat <