Installing VisualEditor for MediaWiki on IIS

This post is part of a series of posts about MediaWiki on Windows :

  1. Installing MediaWiki on Windows Server 2012 R2 Core
  2. Installing VisualEditor for MediaWiki on IIS
  3. Enabling Media / File Uploads For MediaWiki on Windows Server
  • Download and Install Git
    • Get the exe install from http://git-scm.com/download/win
    • Run install from powershell commandline
      • Git.exe /verysilent /LOG="C:\temp\gitinstall.log"
      • Wait a few minutes, then check the log to ensure successful install
      • Add Git folder to Path Environment Variable
        • SETX /M PATH "PATH%;C:\Program Files\Git\bin"
  • VisualEditor extension requires Parsoid (a component which converts wiki-text to html)
    • Download and install Node.js x86 MSI from https://nodejs.org/download/release/latest/
      • msiexec /i node-x.msi /qn /l*v C:\Temp\nodeinstall.log
    • Download and Install Python
      • Download version 2.7.x from https://www.python.org/downloads/
      • msiexec /i python-2.7.x.msi /qn /l*v C:\temp\pythoninstall.log
      • SETX /M PYTHONHOME "C:\Python27"
      • SETX /M PATH "%PATH%;C:\Python27"
    • Set Node Python Version
      • npm config set python python2.7
    • Install Parsoid
      • git clone https://gerrit.wikimedia.org/r/p/mediawiki/services/parsoid
      • npm install
    • Copy the localsettings.js.example file to localsettings.js and edit : you will need to replace this line with url of you mediawiki
      • uri: 'http://localhost/w/api.php',
    • Start parsoid
      • node bin\server.js
      • This will start parsoid in a local session, when the machine is restarted – it won’t run again. We will sort this out at the end…
  • To ensure you get a version of VisualEditor that is compatible with the installed mediawiki visit the following site and download the appropriate version :
  • To enable VisualEditor we need to edit the mediawiki LocalSettings.php and insert the following lines at the bottom

require_once "$IP/extensions/VisualEditor/VisualEditor.php";
// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;
// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';
// OPTIONAL: Enable VisualEditor's experimental code features
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;

  • Go to your wiki in a browser and you should now have an extra ‘Edit Source’ option in the top right – this will take you to the old editor.

visualeditor_1

  • Click the edit button and you should see a loading bar and shortly after that the VisualEditor!

visualeditor_2

(UPDATE – i have noticed that the below will only work after a user logs in, I will edit this post with a fix once I have one…)

  • parsoid is running in a local session and we need to run it automatically.
    • I added a string registry key using regedit
    • HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
    • "C:\Program Files (x86)\nodejs\node.exe" C:\parsoid_install_dir\bin\server.js
  • Reboot the machine and check parsoid is still working by loading your wiki and trying to edit a page. If it doesnt work you the loading bar will pause about 3/4 of the way along

visualeditor_3