Welcome to xTools!¶
Xtools is a system of tools written by User:X! on Wikipedia. The original version lives at http://tools.wmflabs.org/xtools
Pre-requisites¶
Xtools requires the following to run:
- A recent version of Linux (Windows servers are supported, however; you must enable the
app.load_stylesheets_from_cdn
if you want it to look nice). - PHP 5.5.9+ (not tested on PHP7)
- JSON must be enabled.
- ctype needs to be enabled
- You must have
date.timezone
set inphp.ini
. - PDO including the driver for the database you want to use
- Curl must be enabled.
- Composer 1.0.0+
Databases¶
- A main tool database. This just needs to be created, and the xTools user needs create and destroy privilages.
- One or more project databases. This should be a current mediawiki install. The meta database should point to it.
Optional Database¶
If you are running more than one wiki (app.is_single_wiki set to false), information on each wiki must be stored in a meta database. xTools uses one modeled after The WMF Labs database..
This database must live on the same machine as the project databases.
Run sql/meta.sql
to set one up.
Installation¶
To install xTools, please follow these steps:
- Download the repository into your webserver root.
- Run
composer install
- Start your web server.
- Visit your domain in a browser. You should see the xTools landing page
- In order to update the cache after making configuration changes, run
sudo ./clear_cache.sh
from the webserver root.
Configuration¶
As part of the installation of xTools, composer install
or composer update
may prompt you for configuration options. This is a definition
of those options.
- database_host - Hostname for the server with the symfony database
- database_port - Port for the server with the symfony database
- database_name - Database Name for the server with the symfony database
- database_user - Username for the server with the symfony database
- database_password - Password for the server with the symfony database
- database_replica_host - Hostname for the server with the MediaWiki database
- database_replica_port - Port for the server with the MediaWiki database
- database_replica_name - Database Name for the server with the MediaWiki database
- database_replica_user - Username for the server with the MediaWiki database
- database_replica_password - Password for the server with the MediaWiki database
- database_meta_name - Database Name for the server with the meta_p table (This is optional if app.single_wiki is set)
- mailer_transport - Software for the mailer
- mailer_host - Hostname for the mailer
- mailer_user - Username for the mailer software
- mailer_password - Password for the mailer software
- secret - A secret key that’s used to generate certain security-related tokens
- app.noticeDisplay - Display the notice or not
- app.noticeStyle - Style of the notice banner. Available options: “error,” “warning,” “succeess,” “info.”
- app.noticeText - Message shown to the user. If you provide a valid intuition key, it will display that message instead
- app.replag_threshold - Number of seconds to consider the replicas as “lagged”, and show a warning to the user that the data may be out of date
- enable.ec - Enable “Edit Counter” tool
- enable.articleinfo - Enable “Article Information” tool
- enable.pages - Enable “Pages Created” tool
- enable.topedits - Enable “Top Edits” tool
- enable.rangecontribs - Enable “Range Contributions” tool
- enable.blame - Enable “Article Blamer” tool
- enable.autoedits - Enable “Automated Edits” tool
- enable.autoblock - Enable “Autoblock” tool
- enable.adminstats - Enable “Admin Statistics” tool
- enable.adminscore - Enable “Admin Score” tool
- enable.rfa - Enable “RfX Analysis” tool
- enable.rfap - Enable “RfX Vote Calculator” tool
- enable.bash - Enable “Quote Database” tool
- enable.sc - Enable “Plain, Dirty, Simple Edit Counter” tool
- app.load_stylesheets_from_cdn - Whether to load our stylesheets and scripts from a CDN. This is required if xTools is installed on a Windows server
- app.single_wiki - Point xTools to a single wiki, instead of using a meta database. This ignores database_meta_name above.
- app.is_labs - Whether xTools lives on the Wikimedia Foundation Labs environment. This should be set to false.
- wiki_url - URL to use if app.single_wiki is enabled. The title of pages is attached to the end.
Development¶
To contribute to the development of xTools, you may fork us on GitHub. A few things to be aware of first:
- xTools is based on Symfony 3.0. We use Twig as our template engine. Symfony is a full MVC system.
- The controllers are located at
src/AppBundle/controller
. They are sorted by tool- The twig templates are located at
app/resources/views
. They are sorted by tool.
- We use the
@Route
syntax to configure routes. - Every tool requires a twig directory and one controller. Also, core parts of xTools require the tool to be registered within app/config/tools.yml.
Style Guideline¶
- We use 4 spaces to indent code.
- Opening and closing curly braces must be on their own lines.
- Variable names are camelCase. Constants are ALL_CAPS_AND_UNDERSCORES. Function names are camelCase.
- Functions and routes must begin with the tool name.
Running Development server¶
Follow these steps
- Download the repository.
- Run
composer install
- Issue
php bin/console server:run
. - Visit
http://localhost:8000
in your web browser.
The development server does not cache data. Any changes you make are visible after refreshing the page.
Additional Help¶
Please contact User:Matthewrbowker or User:MusikAnimal if you need help. Or, you are welcome to visit us on IRC (Direct link - Requires an IRC client).
Help¶
For help with xTools, there are several places you can ask.
- Github
- Phabricator
- IRC (Direct link - Requires an IRC client)