You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Amanda/DeltaQuad 4453bbd31c
March 2021 Updates (#449)
3 months ago
.github/workflows Create useful seeds for development (#404) 6 months ago
app Ensure oversighters don't lose access after group rename (#452) (#453) 3 months ago
bootstrap Initial Laravel 5.7 3 years ago
config Move creating appeal table to a Laravel job (#289) 6 months ago
database Per-wiki bans (#447) 4 months ago
public Advanced search (#403) 6 months ago
resources Rewrite wiki permission handling job (#451) 4 months ago
routes Block creating appeals from Tor exit nodes (#445) 5 months ago
storage Install the barryvdh/laravel-debugbar package (#374) 8 months ago
tests Rewrite wiki permission handling job (#451) 4 months ago
.env.ci Feature/laravel jobs permission checking (#88) 1 year ago
.env.example Create useful seeds for development (#404) 6 months ago
.gitattributes Upload version 0.2 1 year ago
.gitignore Block creating appeals from Tor exit nodes (#445) 5 months ago
LICENCE Upload version 0.2 1 year ago
LICENSE Initial commit 3 years ago
SECURITY.md Create SECURITY.md 1 year ago
artisan Initial Laravel 5.7 3 years ago
composer.json Purge private data in a Laravel job (#380) 4 months ago
composer.lock March 2021 Updates (#449) 3 months ago
package-lock.json March 2021 Updates (#449) 3 months ago
package.json January 2021 updates (#428) 6 months ago
phpunit.dusk.xml Laravel 8 upgrade (#285) 9 months ago
phpunit.xml.dist meta: rename phpunit.xml to phpunit.xml.dist to allow local customization (#397) 8 months ago
readme.md Add database schema and list UI for storing wikis in the database (#373) 6 months ago
server.php Initial Laravel 5.7 3 years ago
webpack.mix.js Run tests in ci (#22) 1 year ago

readme.md

UTRS 2.0

Getting UTRS2 working in a dev environment

  1. Clone into a directory
  2. composer install
  3. cp .env.example .env
  4. edit the DB details in .env
  5. php artisan key:generate
  6. php artisan migrate:fresh

The /public subdirectory is the webroot. You can either use php artisan serve to run a standalone webserver, or point your webserver of choice at /public

Configuring wikis

Currently, most details about supported wikis are stored in config/wikis.php, but a transition to storing them in the database is in progress. For this reason, you need to use php artisan utrs-maintenance:sync-wikis-to-database to synchronize changes in that file to the database for some details to work correctly.

Building frontend assets

The frontend is built using Bootstrap 4. It uses purgecss to remove unused classes to reduce bundle size. This can create complications for development.

First, install NPM dependencies using npm install. Then, you can use Laravel Mix (webpack wrapper) to build assets:

  • Use npm run watch to start Webpack mix in development watch mode. That mode does not use PurgeCSS and it re-builds all assets when it detects a change. This is most useful when working with JavaScript or when modifying the SCSS files.
  • Use npm run dev to do one build in the development mode. This mode does not use PurgeCSS. This is most useful when you are working on the frontend, as you have access to all classes Bootstrap has to offer.
  • Use npm run prod to do a production build. This build uses PurgeCSS and URL versioning. Due to legacy reasons a production build should be commited to the repository for pull requests. This may change soon, see issue #240.

Seeding

UTRS has a suite of seeds that can be used to automatically generate sample data for your development environment.

To reset your database, and create data based on seeds, you can always type

php artisan migrate:fresh --seed

Resetting your database will get rid of your user account and all of its permissions. You will find few .env variables to help with this:

# for seeding:
DEVELOPER_USER_NAME=""
DEVELOPER_USER_GRANT_ADMIN=""
DEVELOPER_USER_GRANT_TOOLADMIN=""
DEVELOPER_USER_GRANT_DEVELOPER=""

If you set DEVELOPER_USER_NAME to your user name, that user will automatically created. You can then set DEVELOPER_USER_GRANT_ADMIN and DEVELOPER_USER_GRANT_TOOLADMIN to "enwiki" and then you wll be granted admin and tooladmin access there. Finally, if you set DEVELOPER_USER_GRANT_DEVELOPER to true, you will receive the global developer permission which grants you full access to the interface.

Setting up MediaWiki integration for testing

API calls

You have a couple of options here. Either

Create a bot password for your own testing MediaWiki installation

Use Special:BotPasswords to create a bot password. If you have configured e-mail sending to mediawiki, access to that is useful.

In .env, set MEDIAWIKI_USERNAME to the bot password username and MEDIAWIKI_PASSWORD to the password. Also set WIKI_URL_GLOBAL, WIKI_URL_ENWIKI, and WIKI_URL_PTWIKI to be http://your-mediawiki/w/api.php.

Create a bot password on Beta Cluster

This is useful because Beta Cluster is really similar to beta. Use Special:BotPasswords on some wiki to create a bot password (they are global).

In .env, set MEDIAWIKI_USERNAME to the bot password username and MEDIAWIKI_PASSWORD to the password. Also set

  • WIKI_URL_GLOBAL=https://meta.wikimedia.beta.wmflabs.org/w/api.php
  • WIKI_URL_ENWIKI=https://en.wikipedia.beta.wmflabs.org/w/api.php
  • WIKI_URL_PTWIKI=https://es.wikipedia.beta.wmflabs.org/w/api.php # no ptwiki on betacluster, let's use eswiki instead

OAuth

You need a wiki with Extension:OAuth installed. It's easier if you use the same wiki used with API calls.

Use the following settings:

  • Protocol version: 1.0a
  • Callback URL: http://utrs.test/oauth/callback change this depending on your setup
  • "Allow consumer to specify a callback in requests and use "callback" URL above as a required prefix." should be yes
  • Types of grants being requested: "User identity verification only"

If you set it as for yourself only you don't need to get it approved.

Set up .env:

OAUTH_CALLBACK_URL="http://utrs.test/oauth/callback" # change this also depending on your setup

OAUTH_BASE_URL="https://meta.wikimedia.beta.wmflabs.org"
OAUTH_CLIENT_ID="some-client-id"
OAUTH_CLIENT_SECRET="some-client-secret"

Job executor (for production)

For this to work, you need to have your own urls set up for config/wikis.php
This application requires a job queue to verify blocks and do other critical and regualar tasks. Below is a guide to setting up:

  1. pecl install redis
  2. Ensure jobs work with php artisan queue:work
  3. sudo adduser supervisor
  4. sudo apt-get install supervisor
  5. Add the following block at /etc/supervisor/conf.d/utrs.conf, example, replacing /path/tos:

DO NOT CHANGE ANY OF THESE VALUES EXCEPT THE PATHS

[program:utrs-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=supervisor
numprocs=1
redirect_stderr=true
stdout_logfile=/path/to/log/file.log
stopwaitsecs=300
  1. sudo supervisord