MediaWiki development and administration

July 10, 2015

Hacky logging

wfDebug("foo is: $foo", '/tmp/debug.log');

Some kind of updating

vagrant git-update

Integration testing

Get MediaWiki Vagrant:

$ git clone
$ cd vagrant
$ git submodule update --init --recursive
$ ./
$ vagrant config nfs_shares off
$ vagrant up

If there's a false detection of a conflict on port 8080, use ps to find the VBoxHeadless process. Kill it, and try again.

Enable the CirrusSearch Vagrant role:

$ vagrant enable-role cirrussearch
$ vagrant provision

Install various things for running the integration tests:

$ vagrant ssh
$ cd /vagrant/mediawiki/extensions/CirrusSearch/tests/browser/
$ sudo gem install bundler
$ bundle install
$ sudo apt-get install xvfb phantomjs

Run the integration tests:

$ vagrant ssh
$ cd /vagrant/mediawiki/extensions/CirrusSearch/tests/browser/
$ source
$ cucumber features/smoke.feature

This is often needed:

$ vagrant ssh
$ cd /vagrant/mediawiki
$ while true ; do php /vagrant/mediawiki/maintenance/runJobs.php ; sleep 1 ; done


Set up MediaWiki Vagrant.

Enable the EventLogging role:

$ vagrant enable-role eventlogging
$ vagrant provision

Enable the CirrusSearch role:

$ vagrant enable-role cirrussearch
$ vagrant provision

Set up EventLogging debugging:

$ vagrant ssh
$ cd /vagrant/mediawiki/extensions/EventLogging/server/
$ sudo python install
$ eventlogging-devserver --port 8100 --verbose

Copy the configuration values output by the EventLogging devserver and place them in the LocalSettings.php file:

require_once( "$IP/extensions/EventLogging/EventLogging.php" );
$wgEventLoggingSchemaApiUri = '';

Set $wgCirrusSearchEnableSearchLogging to true in /mediawiki/extensions/CirrusSearch/CirrusSearch.php.

Set isSampled to true in /mediawiki/extensions/CirrusSearch/resources/loggingSchema/search.js.


Run searches against production Elasticsearch

Forward localhost:9900 to elastic1001:9200:

$ ssh -N -L 9900:elastic1001.eqiad.wmnet:9200

Search against localhost:9900 and find the resulting titles:

$ curl -s -XGET localhost:9900/enwiki_general_1415927710/_search -d @search.json |  jq -r '.hits|.hits[]|._source|.title'

See mediawiki/search.json