Wikimedia Product Infrastructure team/Push Notifications Infrastructure/MediaWiki development setup
This page documents a suggested process for getting a basic MediaWiki dev environment going for development and review of push notifications support in Echo.
MediaWiki setup and configurationEdit
We recommend using MediaWiki core's native Docker support ("MediaWiki-Docker") for MediaWiki development. Follow the quickstart instructions there to get a barebones MediaWiki installation up and running in Docker.
Next, you'll want to install the default Vector skin. Clone the mediawiki/skins/Vector repo into the skins/ folder:
cd skins git clone ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Vector
The file LocalSettings.php in the project root is used to configure your local MediaWiki installation. Add the following line to LocalSettings.php to enable the Vector skin:
wfLoadSkin( 'Vector' );
Your local wiki at http://localhost:8080 should now have that classic MediaWiki look:
Next, we'll grab the Echo and Thanks extensions. Echo provides web and email notifications in MediaWiki, and is the extension to which we'll be adding push notification support. Thanks provides a quick and easy way to generate notifications.
cd extensions git clone ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo git clone ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Thanks
Enable them in LocalSettings.php by adding the following lines:
wfLoadExtension( 'Echo' ); wfLoadExtension( 'Thanks' );
And run the maintenance script update.php to add the extension tables:
docker-compose exec mediawiki php maintenance/run.php update.php --quick
The Special page Special:Version displays wiki configuration information for any MediaWiki installation. Navigate to http://localhost:8080/wiki/Special:Version to verify that the Vector skin and the Echo and Thanks extensions are loaded as expected:
Finally, run the git-review setup command in the Echo extension root to set it up for Gerrit (if using git-review):
cd extensions/Echo/ git review -s
On-wiki preparation and development workflowEdit
A simple workflow for push notifications development involves creating two new wiki users: one to make edits, and a second to thank the first user for those edits. The first user account is the one we'll use to log in on our client apps to receive pushed Echo notifications. Click on the "Create account" link at the upper right-hand corner of any wiki page (when not logged in), and create a new user account. Then, in a different browser, follow the same workflow to create a second user account.
As the first user, create a new page. Then, as the second user in the other browser, navigate to the newly created page and view its history. You should see the entry reflecting the creation of the page, suffixed with a (thank) link provided by the Thanks extension to allow thanking the user who made the edit.
Click the "thank" link and confirm thanking the first user. Then switch back to the browser with the first user and reload the page. You should see an unread message indicator on the mailbox icon in the upper right-hand corner of the page. Click it, and you should see a notification that the first user was thanked:
This is an easy workflow for generating MediaWiki notifications. A soon-to-be-added patch in Echo will add support for forwarding these to the push notification service.