WordPress Development
Revision as of 11:58, 17 August 2011 by Alex Chapin (talk | contribs)
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.
Contents
Initial Setup
The initial setup of WordPress requires:
- cloning the Midd WordPress git repository
- editing the config.php and .htaccess files
- copying production database
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.
- cd to your public_html directory on chisel:
cd ~/public_html/
- clone the repository and create a working directory with git-clone:
git clone git@chisel.middlebury.edu:wordpress-mu.git wordpress
- cd into new wordpress directory
cd wordpress
- initialize submodules and then update:
git submodule init
git submodule update
Configuring WordPress
- cd to your wordpress directory:
cd ~/public_html/wordpress/
- Create a local copy of your WordPress configuration
cp wp-config.php-midd wp-config.php
- Update local copy of WordPress configuration
-define('DB_NAME', 'username_wordpress');
+define('DB_NAME', 'yourname_wordpress');
-$base'/';
+$base'/~yourname/wordpress/';
- Create a local copy of your .htaccess file:
cp .htaccess-midd .htaccess
- Update local copy of .htaccess file:
-RewriteBase
+RewriteBase /~yourname/wordpress/
Copying production database to development
- Create a database, (e.g. yourname_wordpress) on development server
- Dump the production database
mysqldump -h snipe -u wordpress -p --lock-tables=false --skip-extended-insert wordpress > yourname_wordpress.sql
- 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
- Import updated sql into your development database
mysql -u testuser -ptestpassword -D yourname_wordpress < yourname_wordpress.sql