You are here

Notes on Drupal and Subversion

Putting this code into a page will let it update the site from a repository:

<pre>
<?php system( 'svn up sites/default/...'); ?>
</pre><h1>Done!</h1>

Note that apache must have write permission for the whole directory tree.
I tried the following but couldn't get it to work (probably not in my version of PHP):
svn_checkout('http://myserver.com/svn/demo', '/var/www/html/demo/temp');

If the repository requires a password for update, the following can be done:

  1. svn up --config-dir /var/www/html --username  sites/default/...

    #(will ask for password)
    This will create an auth directory in /var/www/html

  2. chown apache -R /var/www/html/auth
  3. Now the Drupal page can simply contain:
    <pre><?php system('svn up --config-dir /var/www/html sites/default/...'); ?></pre>

Creating a new Drupal site

  1. dget create dirname dbname
  2. #visit site and install Drupal
  3. cd [dirname]/sites
  4. mkdir -p default/themes
  5. chown [username]:[username] -R default
  6. chown apache -R default/files
  7. chmod 755 -R default/files
  8. svn import --username [name] default http://.../drupal


Or, to import in place (logged in as user), use:
svn=http://...
usr="--username [name]"

  1. svn mkdir $usr $svn/drupal -m "make drupal dir"
  2. svn checkout $svn/drupal default
  3. svn add default/*
  4. svn commit default -m "initial upload from website"