MediaWiki-Docker/Extension/VisualEditor
This page is currently a draft.
|
This page instructs you to install Extension:VisualEditor inside MediaWiki-Docker. All commands should be run in the directory where you installed MediaWiki. All mentioned files are also located there.
Install MediaWiki-Docker
editFollow the Quickstart instructions at MediaWiki-Docker page. Once MediaWiki is running and available at http://localhost:8080
, then continue with instructions on this page.
Clone the repository and its dependencies
editgit clone "https://gerrit.wikimedia.org/r/mediawiki/skins/Vector" skins/Vector
git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor" extensions/VisualEditor
cd extensions/VisualEditor
git submodule update --init
Modify LocalSettings.php
editIf not already there, add this to the end of LocalSettings.php
.
wfLoadSkin( 'Vector' );
wfLoadExtension( 'VisualEditor' );
$PARSOID_INSTALL_DIR = 'vendor/wikimedia/parsoid'; # bundled copy
#$PARSOID_INSTALL_DIR = '/my/path/to/git/checkout/of/Parsoid';
// For developers: ensure Parsoid is executed from $PARSOID_INSTALL_DIR,
// (not the version included in mediawiki-core by default)
// Must occur *before* wfLoadExtension()
if ( $PARSOID_INSTALL_DIR !== 'vendor/wikimedia/parsoid' ) {
// AutoLoader::registerNamespaces was added in MW 1.39
AutoLoader::registerNamespaces( [
// Keep this in sync with the "autoload" clause in
// $PARSOID_INSTALL_DIR/composer.json
'Wikimedia\\Parsoid\\' => "$PARSOID_INSTALL_DIR/src",
] );
}
wfLoadExtension( 'Parsoid', "$PARSOID_INSTALL_DIR/extension.json" );
# Manually configure Parsoid
$wgVisualEditorParsoidAutoConfig = false;
$wgParsoidSettings = [
'useSelser' => true,
'rtTestMode' => false,
'linting' => false,
];
$wgVirtualRestConfig['modules']['parsoid'] = [
'url' => 'http://host.docker.internal:8080' . $wgScriptPath . '/rest.php',
];
Run maintenance scripts
editdocker compose exec mediawiki php maintenance/run.php update.php
Troubleshooting
editIf you receive one of the following errors in the browser, try the remedies prescribed below.
"Uncaught ExtensionDependencyError"
editIf you receive an error message in the browser similar to the following
Fatal error: Uncaught ExtensionDependencyError: VisualEditor is not compatible with the current MediaWiki core (version 1.39.4), it requires: >= 1.41. in /var/www/html/w/includes/registration/ExtensionRegistry.php:432 Stack trace: #0 /var/www/html/w/includes/registration/ExtensionRegistry.php(276): ExtensionRegistry->readFromQueue() #1 /var/www/html/w/includes/Setup.php(278): ExtensionRegistry->loadFromQueue() #2 /var/www/html/w/includes/WebStart.php(86): require_once('...') #3 /var/www/html/w/index.php(44): require('...') #4 {main} thrown in /var/www/html/w/includes/registration/ExtensionRegistry.php on line 432
perform these steps to check out a compatible branch of the extension (in this example, REL1_39
)
cd extensions/VisualEditor
git checkout -tb REL1_39 origin/REL1_39
and refresh the page to try again.
"Error contacting the Parsoid/RESTBase server"
editIf you receive the following error when attempting to use VisualEditor for the first time
Error contacting the Parsoid/RESTBase server: (curl error: 7) Couldn't connect to server
you will most likely need to replace the Parsoid config setting 'url' => 'http://host.docker.internal:8080'
in your LocalSettings.php
with the internal IP of the container running the web server. For example:
$wgVirtualRestConfig['modules']['parsoid'] = [
'url' => 'http://172.17.0.1:8080' . $wgScriptPath . '/rest.php',
];
If you have jq
installed, this command will return the appropriate information:
docker network inspect mediawiki_default | jq '.[].Containers[] | select(.Name | test("web"))'
mediawiki_default
comes from the output of docker network inspect
. (I think) it is inferred from the docker-compose.yml
, and may be subject to change.Example output:
{ "Name": "mediawiki_mediawiki-web_1", "EndpointID": "29155dfdac8e4194d4100bdaf5ddbe91ee0e66f52842145985ce6aa6e894c563", "MacAddress": "e0:e0:e0:e0:e0:e0", "IPv4Address": "172.17.0.1/16", "IPv6Address": "" }