MediaWiki Development Through github

This page presents a first draft of a process for developing websites in a local environment, using github. This process was used with the following website:

Site: Inclusive Learning Design Handbook
Public URL: http://handbook.floeproject.org/index.php
Github: https://github.com/fluid-project/handbook.floeproject.org

We will be working towards automating and simplifying this process as much as possible.

Setting Up The Environment

You will need a web server and a database on your local development machine. For the Inclusive Learning Design Handbook, the database is Postgres.

  1. Set up a local web server, e.g. MAMP on a Mac.
  2. Increase PHP's memory by editing php.ini: Set memory_limit to 64M.
  3. Install Postgres on your local machine.
  4. Set up the local user and database:

    createuser -U postgres -P accessibility_floe
    createdb -U accessibility_floe accessibility_floeproject_org
  5. Create a dump of the database on server (you may need an administrator to generate this for you):

    pg_dump -C -U accessibility_floe  -f handbook.dump.sql accessibility_floeproject_org
  6. Copy the database dump from the server to your local machine (e.g. using scp or ftp).
  7. Import the database dump into the local database:

    psql -U postgres < handbook.dump.sql

Set Up The Website In The Local Environment

Once you have a web server and the database setup, you need to get a copy of the MediaWiki instance.

  1. Fork the github project into your own github account.
  2. Clone your fork onto your development machine, into MAMP's htdocs folder (not into a subfolder of htdocs).
  3. Copy the handbook's LocalSettings.php from the server to your local machine (e.g. using scp or ftp.
  4. Place the LocalSettings.php file in the htdocs folder.
  5. Create a branch of the development branch for the work.
  6. Make whatever changes you wish to make, etc. Test using http://localhost:8888.
  7. Commit your changes to your branch and push the branch to your github account.
  8. Issue a pull request ensuring that the request is to merge into the development branch (not master).

Process Issues

We need a way to ensure that any changes to LocalSettings.php make their way back to the server. The file is NOT included in github, for security reasons.

Reviewing Pull Requests

A members of the ops team will deal with pull requests. We will eventually be automating some of what happens with the pull request. Here is a suggested workflow in the interim:

  1. Review the request for correctness, cleanliness and maintainability and provide feedback to the requester.
  2. Once you are happy with the pull request, push it to the development branch.
  3. Log onto the server and pull the updates to the development site.
  4. Request an informal review from someone on the design team of the development site.
  5. When the design team signs off, push the modifications to the master branch.
  6. Log onto the server and pull the updates to the live site.

Possible Error

Don't panic if you see the following error:

Notice: Use of undefined constant edit - assumed 'edit' in
/Applications/MAMP/htdocs/handbook.floeproject.org/LocalSettings.php on line 157

This is apparently caused by an error in the default LocalSettings.php file. The assumption made is correct and the site works, but the error can be eliminated by changing

$wgGroupPermissions['*']['edit'] = edit;

to

$wgGroupPermissions['*']['edit'] = true;

in LocalSettings.php.