ORES extension local development guide
This guide is based on https://gerrit.wikimedia.org/g/mediawiki/core/+/HEAD/DEVELOPERS.md and it is slightly modified so that we can run it with the ORES extension.
Install MediaWiki with Docker
- Clone MediaWiki repo:
git clone https://gerrit.wikimedia.org/r/mediawiki/core mediawiki
- Create an .env file
MW_SCRIPT_PATH=/w MW_SERVER=http://localhost:8080 MW_DOCKER_PORT=8080 MEDIAWIKI_USER=Admin MEDIAWIKI_PASSWORD=dockerpass XDEBUG_CONFIG= XDEBUG_ENABLE=true XHPROF_ENABLE=true MW_DOCKER_UID=501 MW_DOCKER_GID=20
- Add this in docker-compose.override.yml to use a mariadb database and expose the port to our localhost. This comes from MediaWiki-Docker/Configuration recipes/Alternative databases. Note: We name the database as enwiki (or any other wiki) otherwise ORES service won’t be able to find a model for a wiki name that doesn’t exist.
services: mariadb: image: 'bitnami/mariadb:latest' volumes: - mariadbdata:/bitnami/mariadb environment: - MARIADB_ROOT_PASSWORD=root_password - MARIADB_USER=my_user - MARIADB_PASSWORD=my_password - MARIADB_DATABASE=enwiki ports: - 3306:3306 volumes: mariadbdata: driver: local
- Start the containers and install PHP dependencies from Composer:
docker compose up docker compose exec mediawiki composer update
- We run the following command to install and configure MediaWiki. We name the database as enwiki otherwise ORES service won’t be able to find a model for a wiki name that doesn’t exist. Alternatively we could point to another service that would have such a wikiname e.g. a local running instance of ores-legacy app
docker compose exec mediawiki /bin/bash -c 'php maintenance/run.php install --dbname=enwiki --dbuser=my_user --dbpass=my_password --dbserver=mariadb --server="${MW_SERVER}" --scriptpath="${MW_SCRIPT_PATH}" --lang en --pass ${MEDIAWIKI_PASSWORD} mediawiki ${MEDIAWIKI_USER}'
Install ORES extension
cd mediawiki
git clone https://gerrit.wikimedia.org/r/mediawiki/skins/Vector skins/Vector
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/ORES extensions/ORES
Add the following code at the bottom of your LocalSettings.php:
wfLoadSkin( 'Vector' );
wfLoadExtension( 'ORES' );
Create the database tables:
docker compose exec mediawiki php maintenance/update.php
Score existing revisions
Score revisions and populate database tables:
docker compose exec mediawiki php maintenance/run.php ./extensions/ORES/maintenance/PopulateDatabase.php