WordPress Development

Revision as of 16:35, 10 August 2011 by Alex Chapin (talk | contribs) (Configuration)

WordPress is used at Middlebury by a variety of individuals and groups including faculty, staff, students, administrators, designers, developers, librarians, technologists, academic and administrative departments, offices, student organizations, courses, initiatives, projects and so on. This document compiles recommendations about how Wordpress at Middlebury should be configured, updated and maintained.

Initial Setup

Cloning the central repository

Your ssh keys must be authorized to access the central repository. All chisel accounts' ssh keys have been authorized to do so at the time of this writing. Contact Adam to add ssh keys for other machines (such as your desktop) if desired.

  1. cd to your public_html directory on chisel:
    cd ~/public_html/
  2. clone the repository and create a working directory with git-clone:
    git clone git@chisel.middlebury.edu:wordpress-mu.git wordpress
  3. cd into new wordpress directory
    cd wordpress
  4. initialize submodules and then update:
    git submodule init
    git submodule update


  1. cd to your wordpress directory:
    cd ~/public_html/wordpress/
  2. Create a local copy of your WordPress configuration
    cp wp-config.php-midd wp-config.php
    -define('DB_NAME', 'username_wordpress');
    +define('DB_NAME', 'yourname_wordpress');
  3. Create a local copy of your .htaccess file:
    cp .htaccess-midd .htaccess
  4. Update local copy of .htaccess file:
    +RewriteBase /~yourname/wordpress/

Copy the database to development

  1. Create a database, (e.g. yourname_wordpress) on development server
  2. Dump the production database
    mysqldump -h snipe -u wordpress -p --lock-tables=false --skip-extended-insert wordpress > yourname_wordpress.sql
  3. Re-write server specific values in SQL using perl scripts
    perl -p -i -e
    's#http://blogs.middlebury.edu#http://chisel.middlebury.edu/~yourname/wordpress#gi' yourname_wordpress.sql
    perl -p -i -e 's#blogs.middlebury.edu#chisel.middlebury.edu#gi' yourname_wordpress.sql
     perl -p -i -e
    "s#chisel\.middlebury\.edu','/#chisel.middlebury.edu','/~yourname/wordpress/#gi" yourname_wordpress.sql
  4. Import updated sql into your development database
    mysql -u testuser -ptestpassword -D yourname_wordpress < yourname_wordpress.sql