XTools/Development/Configuration

As part of the installation of XTools, you'll need to provide values for various configuration options. Sensible defaults are included, but at minimum you should have your own database connection. All configuration is done in the .env file, which should be initially copied from .env.dist.

Databases edit

XTools database edit

XTools records basic usage stats in its own database. As a developer, unless you are working on this feature (see https://xtools.wmflabs.org/meta), you can leave these options blank.

  • DATABASE_HOST – Hostname for the server with the XTools database.
  • DATABASE_PORT – Port for the server with the XTools database.
  • DATABASE_NAME – Database name of the XTools database.
  • DATABASE_USER – Username for the XTools database.
  • DATABASE_PASSWORD– Password for the user for the XTools database.

Database replicas edit

  • DATABASE_REPLICA_USER – Username for the replica databases. Use the credentials specified in the replica.my.cnf file, located in the home directory of your Toolforge account.
  • DATABASE_REPLICA_PASSWORD – Password for the replica databases.
  • DATABASE_REPLICA_HOST_S1 DATABASE_REPLICA_PORT_S1 – Host and port for the s1 slice. Repeat for all 8 slices. See XTools/Development#Developing against Toolforge replicas for more. In production these values should be s1.web.db.svc.wikimedia.cloud (replacing s1 with the corresponding slice), and all ports should be 3306.

Tools-db edit

Some parts of XTools such as the Page History tool communicate with the Toolforge user databases, such as checkwiki.

  • DATABASE_TOOLSDB_HOST – MySQL host name (127.0.0.1 if connecting to the replicas via SSH tunnel). On production this should be tools.db.svc.eqiad.wmflabs
  • DATABASE_TOOLSDB_PORT – MySQL port number. Use 3306 in production.

Authentication and email edit

OAuth is used to allow users to make unlimited requests, and to allow them to see detailed statistics of their own account. The credentials need to be requested from meta:Special:OAuthConsumerRegistration. If you are developing locally, you can leave these options blank.

  • OAUTH_KEY – Oauth consumer key.
  • OAUTH_SECRET – Oauth consumer secret.

Email is only used to send error reports to the maintainers. If you don't care about this (such as in development installations), you can use the defaults for all mailer options and no emails will be sent.

  • MAILER_DSN – The data source path of the mailer, including any necessary credentials.

Caching edit

In development, the filesystem is used as the caching adapter. In production, it uses APCu. Since XTools version 3.17, the adapters are no longer configurable.

Wiki configuration edit

These configuration options are relics from when XTools was meant to work with any MediaWiki installation. Should support for 3rd party wikis ever be restored, we are keeping these options in the codebase. If you are working against Wikimedia wikis, you can use the default values for all of these.
  • WIKI_URL – Full URL of the wiki, used only if app.single_wiki is set to true. The title of pages are attached to the end.
  • API_PATH – The API path for the projects, usually /w/api.php.
  • DEFAULT_PROJECT – The base URL of whatever wiki you consider to be the “default”. This will be the default value for the “Project” field in the forms. On the Wikimedia installation, en.wikipedia.org is used because it is the most popular wiki. For single-wiki installations, the “Project” field in the forms are hidden, but you still need to provide this value for default_project.
  • CENTRAL_AUTH_PROJECT – Which wiki should be used for CentralAuth (if applicable), and also for OAuth authentication. You may want this to be the same as the default_project.
  • OPTED_IN – A list of database names of projects that will display restricted statistics regardless of individual users' preferences. For developers working off of the replicas, use "enwiki,newiki"

Application edit

  • APP_ENV – Use dev for local environments.
  • APP_SECRET – A secret key that’s used to generate certain security-related tokens, and as the secret for the internal API. This can be any non-blank value. If you are using a separate API server (see Wikitech docs), this parameter must have the same value on both the app server and API server. nux.net/secret can auto-generate a secure token for you.
  • APP_NOTICE_DISPLAY – This is used to broadcast a notice at the top of XTools. Set to 1 to turn this feature on.
  • APP_NOTICE_STYLE – Style of the notice banner, correlating to the Bootstrap contextual classes. Available options include danger, warning, info and success.
  • APP_NOTICE_TEXT – Message shown to the user. If you provide a valid i18n message key, it will display that message instead.
  • APP_SINGLE_WIKI – Point XTools to a single wiki, instead of using a meta database. Use 0 if you are developing against the wiki replicas.
  • APP_IS_WMF – Whether XTools lives on the Wikimedia Foundation Cloud Services environment. If you are developing against the wiki replicas through an SSH tunnel, set this to 1
  • 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. For WMF installations, this parameter is obsolete and can be left blank, as the new replicas do not suffer from noticeable lag.
  • APP_QUERY_TIMEOUT – Maximum allowed time for queries to run. This is to ensure database quota is not exceeded.
  • APP_RATE_LIMIT_TIME – Used for rate limiting. This parameter is the number of minutes during which APP_RATE_LIMIT_COUNT requests from the same user are allowed. Set this to 0 to disable rate limiting.
  • APP_RATE_LIMIT_COUNT – Number of requests from the same user that are allowed during the time frame specified by APP_RATE_LIMIT_TIME. Set this to 0 to disable rate limiting.
  • APP_MAX_PAGE_REVISIONS – Set a maximum number of revisions to process for pages. This is to safeguard against unnecessarily consuming too many resources for queries that will most surely timeout. Set this to 0 to disable all limitations.
  • APP_MAX_USER_EDITS – Querying a user that has more edits than this will be rejected. This is to safeguard against unnecessarily consuming too many resources for queries that will most surely timeout. Set this to 0 to disable all limitations.

Tools edit

Selectively choose which tools to enable within XTools.

  • APP_ENABLE_ADMINSCORE – Enable the Admin Score tool.
  • APP_ENABLE_ADMINSTATS – Enable the Admin Statistics tool.
  • APP_ENABLE_ARTICLEINFO – Enable the Page History (aka ArticleInfo) tool.
  • APP_ENABLE_AUTHORSHIP – Enable the Authorship tool (WMF-only).
  • APP_ENABLE_AUTOEDITS – Enable the Automated Edits tool.
  • APP_ENABLE_BLAME – Enable the Blame tool (WMF-only).
  • APP_ENABLE_CATEGORYEDITS – Enable the Category Edits tool.
  • APP_ENABLE_EDITCOUNTER – Enable the Edit Counter tool.
  • APP_ENABLE_EDITSUMMARY – Enable the Edit Summaries tool.
  • APP_ENABLE_GLOBALCONTRIBS – Enable the Global Contributions tool.
  • APP_ENABLE_LARGESTPAGES – Enable the Largest pages tool.
  • APP_ENABLE_META – Enable the Meta tool, which tracks usage of the XTools installation.
  • APP_ENABLE_PAGES – Enable the Pages Created tool.
  • APP_ENABLE_QUOTE – Enable the Bash Quotes tool.
  • APP_ENABLE_SIMPLEEDITCOUNTER – Enable the Simple Counter tool.
  • APP_ENABLE_TOPEDITS – Enable the Top Edits tool.