A tool that allows you to see recent Wikipedia edits that are flagged as possible copyright violations.
- User documentation: https://meta.wikimedia.org/wiki/Special:MyLanguage/CopyPatrol
- Issue tracker: https://phabricator.wikimedia.org/tag/copypatrol/
- Frontend source code (this repo): https://github.com/wikimedia/CopyPatrol
- Bot source code: https://github.com/JJMC89/copypatrol-backend
- PHP 8.1+
- Symfony CLI
- Node using the version specified by .nvmrc
- Consider using Fresh for Node dependencies.
- Toolforge access
This application makes use of the Symfony framework and the ToolforgeBundle. A bot is used to continually query recent changes against the Turnitin Core API (TCA), record possible copyright violations in a user database, and CopyPatrol then reads from that database. Unless you need to work on the bot code, there's no reason to bother with bot integration, and instead connect to the existing user database on Toolforge (more on this below).
- Copy .env to .env.local and fill in the appropriate details.
- Use the credentials in your
replica.my.cnf
file in the home directory of your Toolforge account forREPLICAS_USERNAME
,REPLICAS_PASSWORD
. - Set the
TROVE_*
variables to that of the installation of the CopyPatrol database (COPYPATROL_DB_NAME
). - If you need to test OAuth, obtain tokens by registering a new consumer on Meta at
Special:OAuthConsumerRegistration.
Alternatively, you can set
LOGGED_IN_USER
to any value to simulate being that user after clicking on 'Login'. - If you need to test the "iThenticate report" functionality, set
TCA_DOMAIN
andTCA_KEY
. Reports older thanAppController::ITHENTICATE_V2_TIMESTAMP
need to connect to the older iThenticate API, using the credentials set byITHENTICATE_USERNAME
andITHENTICATE_PASSWORD
.
- Use the credentials in your
- Run
composer install
- Open up an SSH tunnel to access the databases on Toolforge. This assumes you have left
the
REPLICAS_HOST_*
andREPLICAS_PORT_*
variables at their defaults.Review OpenStack browser for the current Trove host name if the above does not work.symfony console toolforge:ssh --trove=hxmnwriu2vm.svc.trove.eqiad1.wikimedia.cloud
- Start the Symfony web server with
symfony serve
- Visit the URL provided by the Symfony CLI to access the application.
Assets are compiled using Webpack Encore. The compiled assets must be committed to the repository.
- Run
npm run dev
to compile assets for development and watch for changes. - Run
npm run build
to compile assets for production.
- Run
composer test
to run the unit tests and PHP CodeSniffer. - Run
npm test
to run the linting tests for JavaScript and CSS.
A new Docker image needs to be created following the move to Wikimedia VPS. You can use the manual installation instructions above in the meantime.
- Make sure the language is supported by iThenticate. This list is available at https://www.ithenticate.com/resources under the "General" section of the FAQ. Look for "Which international languages does iThenticate have content for in its database?".
- Make sure there is community consensus for CopyPatrol. This helps ensure they will regularly make use of CopyPatrol. The bot which powers the CopyPatrol feed is expensive in terms of the resources it uses. Any languages that are not regularly being used should be removed.
- Make sure the corresponding
-wikipedia
message in i18n/en.json (and qqq.json exists and is translated in the desired language. - Update the
.copypatrol.ini
file in the bot repository and add the new languages to theAPP_ENABLED_LANGS
variable in .env.
- In
.copypatrol.ini
of the bot repository, set theenabled
key for the desired language tofalse
, or remove the definition entirely. - Remove the language from the
APP_ENABLED_LANGS
variable in .env.
The master
branch is automatically deployed to the staging environment
when changes are pushed. The production instance is updated when a new
version is tagged:
- Update the
APP_VERSION
in .env to the new version, using the CalVer format. - Push the changes to the
master
branch. - Create a new release on GitHub with the same tag.
The production instance should be updated within 10 minutes.