Content translation/Developers/Setup


Requirements Requirements in short

MySQL/MariaDB is the recommended DBMS. PostgreSQL or SQLite can also be used, but support for them is somewhat less mature.


1. Install XAMPP (version 7.2 is the current minimum)Edit

This installs all requirements listed in the table on the side.

2. In directory where you want you mediawiki installation to reside, run:Edit

git clone "https://gerrit.wikimedia.org/r/mediawiki/core"

This will clone Mediawiki core in the folder of your choosing.

3. Change DocumentRoot and Directory in Apache config to point to your Mediawiki core folderEdit

From your XAMPP control panel, open Apache config file named httpd.conf. Find DocumentRoot and Directory lines and change path from where your server should serve files. For example, on Windows, this could look like:

DocumentRoot "D:/path-to/mediawiki/core"
<Directory "D:/path-to/mediawiki/core">

4. Open http://localhost in browser and go through installation processEdit

This tutorial assumes you're installing Mediawiki core for the first time, or doing it fresh. If you already had Mediawiki core, delete LocalSettings.php file to start installation again. In the installer, you will be asked to create database and admin users for your wiki, among other things. The process is quite self-explanatory and straightforward.

5. Try using your wiki to verify successful installationEdit

6. To install extensions, from your core/extensions/ directory, run:Edit

git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/BetaFeatures"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/cldr"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/ContentTranslation"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/EventLogging"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/EventStreamConfig"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/GlobalPreferences"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/Math"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/Translate"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/UniversalLanguageSelector"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/WikimediaEvents"
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/WikimediaMessages"

7. Change directory to core/extensions/VisualEditor and run:Edit

git submodule update --init

8. Change directory to core/skins/ and run:Edit

git clone "https://gerrit.wikimedia.org/r/mediawiki/skins/Vector"

9 Add following to LocalSettings.phpEdit

Not all of the settings below are needed immediatelly and some are commented to be used with convenience when needed.

wfLoadSkin( 'Vector' );
// wfLoadSkin( 'MonoBook' );
// wfLoadSkin( 'MinervaNeue' );

$EXT = "$IP/extensions";

# $wgReadOnly = true;
# $wgEnablePartialBlocks = true;

wfLoadExtension( 'cldr' );
wfLoadExtension( 'EventStreamConfig' );

/* wfLoadExtension( 'LocalisationUpdate' );
$wgLocalisationUpdateDirectory = "$IP/cache";*/

wfLoadExtension( 'Translate' );

$wgGroupPermissions['user']['translate'] = true;
$wgGroupPermissions['user']['translate-messagereview'] = true;
$wgGroupPermissions['user']['translate-groupreview'] = true;
$wgGroupPermissions['user']['translate-import'] = true;
$wgGroupPermissions['sysop']['pagetranslation'] = true;
$wgGroupPermissions['sysop']['translate-manage'] = true;
$wgTranslateDocumentationLanguageCode = 'qqq';
$wgExtraLanguageNames['qqq'] = 'Message documentation'; # No linguistic content. Used for documenting messages

wfLoadExtension( 'UniversalLanguageSelector' );
// $wgULSCompactLanguageLinksBetaFeature = false;
// $wgULSEventLogging = true;

wfLoadExtension( 'Echo' );

wfLoadExtension( 'Cite' );

wfLoadExtension( 'GlobalPreferences' );
$wgSharedDB = $wgDBname;
$wgSharedTables = [ 'user' ]; // Note that 'user_properties' is not included.

wfLoadExtension( 'ContentTranslation' );
$wgContentTranslationSiteTemplates['cx'] = 'https://cxserver.wikimedia.org/v1';
# $wgContentTranslationCXServerAuth['key'] = 'supersecretkey';
$wgContentTranslationEnableSuggestions = true;
/* $wgContentTranslationUnmodifiedMTThresholdForPublish = 35;
$wgContentTranslationAsBetaFeature = false;
$wgContentTranslationPublishRequirements = [
	'userGroups' => [ 'extendedconfirmed', 'sysop' ]
];*/

$wgMinervaCustomLogos = [
  'copyright' => 'https://sr.wikipedia.org/static/images/mobile/copyright/wikipedia-wordmark-sr.svg',
  'copyright-width' => 122,
  'copyright-height' => 22,
];

/*
// FancyCaptcha
wfLoadExtensions([ 'ConfirmEdit', 'ConfirmEdit/FancyCaptcha' ]);
$wgCaptchaClass = 'FancyCaptcha';

$wgCaptchaDirectory = "$IP/extensions/ConfirmEdit/captcha";
$wgCaptchaDirectoryLevels = 0;
$wgCaptchaSecret = "test";*/

/*
// QuestyCaptcha
wfLoadExtensions([ 'ConfirmEdit', 'ConfirmEdit/QuestyCaptcha' ]);
$wgCaptchaQuestions = [
	'What is the capital of France?' => 'Paris',
	'What is the capital of Spain' => 'MADRID', // Answers are case insensitive
	'How many fingers does a hand have?' => [ 5, 'five' ], // A question may have many answers
];*/

// $wgCaptchaTriggers['edit'] = true; 
// $wgCaptchaTriggers['create'] = true;

# Don't ask for a captcha for users with more than this number of edits.
// $wgCaptchaTrustedThreshold = 1500; // default 100
# Always reject edits adding new external links with less than this number of edits.
// $wgCaptchaNewbieThreshold = 100;   // default 5

// Abuse filter
wfLoadExtension( 'AbuseFilter' );

// wfLoadExtension( 'MobileFrontend' );
// $wgMFAutodetectMobileView = true;

wfLoadExtension( 'VisualEditor' );
// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;
// Optional: Set VisualEditor as the default for anonymous users
// otherwise they will have to switch to VE
// $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';
// OPTIONAL: Enable VisualEditor's experimental code features
# $wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;

wfLoadExtension( 'BetaFeatures' );

wfLoadExtension( 'EventLogging' );

/* wfLoadExtension( 'Interwiki' );
// To grant sysops permissions to edit interwiki data
$wgGroupPermissions['sysop']['interwiki'] = true;*/

wfLoadExtension( 'WikimediaEvents' );
wfLoadExtension( 'WikimediaMessages' );

wfLoadExtension( 'Math' );

# RC filters
# $wgStructuredChangeFiltersEnableExperimentalViews = true;
# $wgDefaultUserOptions['rcenhancedfilters'] = 1;
# $wgStructuredChangeFiltersOnWatchlist = true;
# $wgStructuredChangeFiltersShowPreference = true;
# $wgStructuredChangeFiltersLiveUpdatePollingRate = false;

/*$wgPasswordPolicy = [
	'policies' => [
		'bureaucrat' => [
			'MinimalPasswordLength' => 1,
			'MinimumPasswordLengthToLogin' => 1,
			'PasswordNotInLargeBlacklist' => false,
		],
		'sysop' => [
			'MinimalPasswordLength' => 1,
			'MinimumPasswordLengthToLogin' => 1,
			'PasswordNotInLargeBlacklist' => false,
		],
		'interface-admin' => [
			'MinimalPasswordLength' => 1,
			'MinimumPasswordLengthToLogin' => 1,
			'PasswordNotInLargeBlacklist' => false,
		],
		'bot' => [
			'MinimalPasswordLength' => 1,
			'MinimumPasswordLengthToLogin' => 1,
			'PasswordNotInLargeBlacklist' => false,
		],
		'default' => [
			'MinimalPasswordLength' => 1,
			'PasswordCannotMatchUsername' => false,
			'PasswordCannotMatchBlacklist' => false,
			'MaximalPasswordLength' => 4096,
		],
	],
	'checks' => [
		'MinimalPasswordLength' => 'PasswordPolicyChecks::checkMinimalPasswordLength',
		'MinimumPasswordLengthToLogin' => 'PasswordPolicyChecks::checkMinimumPasswordLengthToLogin',
		'PasswordCannotMatchUsername' => 'PasswordPolicyChecks::checkPasswordCannotMatchUsername',
		'PasswordCannotMatchBlacklist' => 'PasswordPolicyChecks::checkPasswordCannotMatchBlacklist',
		'MaximalPasswordLength' => 'PasswordPolicyChecks::checkMaximalPasswordLength',
		'PasswordCannotBePopular' => 'PasswordPolicyChecks::checkPopularPasswordBlacklist',
		'PasswordNotInLargeBlacklist' => 'PasswordPolicyChecks::checkPasswordNotInLargeBlacklist',
	],
];*/

$wgShowExceptionDetails = true;
$wgShowSQLErrors        = true;
$wgShowDBErrorBacktrace = true;
# $wgDebugComments        = true;
$wgDebugDumpSql         = true;
$wgDevelopmentWarnings  = true;
$wgDebugTimestamps = true;
$wgDebugPrintHttpHeaders = false;
$wgEnableJavaScriptTest = true;

10. Change directory to core/ and runEdit

composer install

php maintenance/update.php --quick


You may need to run composer update as well, if this is not your first time running the install command.

One problem encountered on MacOS during execution of PHP maintenence script was with connecting to DB:

Wikimedia\Rdbms\DBConnectionError from line 1415 of /Users/mwuser/code/mediawiki/core/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Cannot access the database: Unknown error (localhost)

The problem was solved by making following change in LocalSettings.php:

$wgDBserver = "localhost";$wgDBserver = "127.0.0.1";