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.
- Set up a local web server, e.g. MAMP on a Mac.
- Increase PHP's memory by editing
php.ini
: Setmemory_limit
to 64M. - Install Postgres on your local machine.
Set up the local user and database:
createuser -U postgres -P accessibility_floe createdb -U accessibility_floe accessibility_floeproject_org
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
- Copy the database dump from the server to your local machine (e.g. using
scp
orftp
). 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.
- Fork the github project into your own github account.
- Clone your fork onto your development machine, into MAMP's
htdocs folder
(not into a subfolder ofhtdocs
). - Copy the handbook's
LocalSettings.php
from the server to your local machine (e.g. usingscp
orftp
. - Place the
LocalSettings.php
file in thehtdocs
folder. - Create a branch of the
development
branch for the work. - Make whatever changes you wish to make, etc. Test using
http://localhost:8888
. - Commit your changes to your branch and push the branch to your github account.
- Issue a pull request ensuring that the request is to merge into the
development branch
(notmaster
).
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:
- Review the request for correctness, cleanliness and maintainability and provide feedback to the requester.
- Once you are happy with the pull request, push it to the
development
branch. - Log onto the server and pull the updates to the development site.
- Request an informal review from someone on the design team of the development site.
- When the design team signs off, push the modifications to the
master
branch. - 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
.