Skip to content

Latest commit

 

History

History
458 lines (328 loc) · 21.2 KB

install-extensions.rst

File metadata and controls

458 lines (328 loc) · 21.2 KB

Install MediaWiki Extensions

  1. Start the virtual machine and log in:

    ssh -p 8015 hjc@dynamicshjc.case.edu
  2. Check for and install system updates on the virtual machine:

    sudo apt-get update
    sudo apt-get dist-upgrade
    sudo apt-get autoremove
  3. Install these new packages,

    Package Description
    phpCAS PHP implementation of Central Auth Service

    php-ldap

    LDAP module for PHP for looking up real names when wiki accounts are created

    parsoid

    Web service converting HTML+RDFa to MediaWiki wikitext and back (prereq for VisualEditor)

    dvipng

    convert DVI files to PNG graphics (prereq for Math)

    ocaml

    ML language implementation with a class-based object system (prereq for Math)

    texlive-latex-recommended

    TeX Live: LaTeX recommended packages (prereq for Math)

    texlive-latex-extra

    TeX Live: LaTeX additional packages (prereq for Math)

    texlive-fonts-recommended

    TeX Live: Recommended fonts (prereq for Math)

    texlive-lang-greek TeX Live: Greek (prereq for Math)

    using the following:

    sudo apt-get install php-cas php-ldap dvipng ocaml texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended texlive-lang-greek
    sudo apt-key advanced --keyserver pgp.mit.edu --recv-keys 90E9F83F22250DD7
    sudo apt-add-repository "deb https://releases.wikimedia.org/debian jessie-mediawiki main"
    sudo apt-get update
    sudo apt-get install parsoid

    Change parsoid install command to use a specific version known to work with MW 1.27 (version "0.5.3all" ?).

  4. Restart the web server:

    sudo apache2ctl restart
  5. Download these extensions,

    Extension Description

    CASAuthentication

    integration with university Single Sign-On

    EmbedVideo embed online videos in wiki pages
    ImportUsers1 create user accounts from CSV files
    Lockdown restrict access to specific namespaces
    Math math typesetting
    MobileFrontend better wiki interface for smartphones
    NewArticleTemplate auto-fill new pages with template text
    Realnames replace user names with real names
    ScholasticGrading assign and report grades

    Scribunto

    embed scripts in Module namespace (prereq for citation and license templates)

    UserMerge merge contributions and delete users
    VisualEditor WYSIWYG editor for wiki atricles

    using the following:

    cd /var/www/mediawiki/extensions/
    
    # CASAuthentication
    git clone https://github.com/CWRUChielLab/CASAuth.git
    
    # EmbedVideo
    git clone https://github.com/HydraWiki/mediawiki-embedvideo.git EmbedVideo
    git -C EmbedVideo checkout -q v2.3.3  # latest release as of Aug 2016
    
    # ImportUsers
    git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ImportUsers.git
    git -C ImportUsers checkout -q REL1_27
    
    # Lockdown
    git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Lockdown.git
    git -C Lockdown checkout -q REL1_27
    
    # Math
    git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Math.git
    git -C Math checkout -q REL1_27
    make -C Math  # build texvc
    
    # MobileFrontend
    git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/MobileFrontend.git
    git -C MobileFrontend checkout -q REL1_27
    
    # NewArticleTemplate
    git clone https://github.com/mathiasertl/NewArticleTemplates.git NewArticleTemplate
    git -C NewArticleTemplate checkout -q cff90b32  # latest commit as of Aug 2016
    
    # Realnames
    wget -O Realnames.tar.gz http://ofbeaton.com/releases/Realnames/Realnames_0.3.1_2011-12-25.tar.gz
    tar -xf Realnames.tar.gz && rm Realnames.tar.gz
    
    # ScholasticGrading
    git clone https://github.com/CWRUChielLab/ScholasticGrading.git
    
    # Scribunto
    git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Scribunto.git
    git -C Scribunto checkout -q REL1_27
    
    # UserMerge
    git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/UserMerge.git
    git -C UserMerge checkout -q REL1_27
    
    # VisualEditor
    git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git
    git -C VisualEditor checkout -q REL1_27
    git -C VisualEditor submodule update --init

    Consider adding Mathoid installation instructions. In its current form, this instruction set utilizes the Math extension's PNG mode. By changing $wgDefaultUserOptions['math'] to 'mathml' in LocalSettings.php, an alternate MathML mode can be used. This requires a Mathoid server for runtime equation rendering. The $wgMathFullRestbaseURL setting specifies a server in Germany that is free to use but is occasionally unresponsive, causing the wiki to either load slowly or fail to render equations. By building a local Mathoid server, responsiveness and reliability could be guarenteed. However, after much effort, Jeff has not been able to get a Mathoid installation working yet. Since MathML offers few advantages over PNG mode, getting this working is a low priority.

  6. Download and install the CAS (Single Sign-On) configuration file:

    wget -O /var/www/mediawiki/extensions/CASAuth/CASAuthSettings.php https://neurowiki-docs.readthedocs.io/en/latest/_downloads/CASAuthSettings.php

    Randomize the secret key inside the configuration file:

    sed -i '/^\$CASAuth\["PwdSecret"\]/s|=".*";|="'$(openssl rand -hex 32)'";|' /var/www/mediawiki/extensions/CASAuth/CASAuthSettings.php

    Protect the secret key:

    sudo chmod ug=rw,o= /var/www/mediawiki/extensions/CASAuth/CASAuthSettings.php*

    If you are curious about the contents of CASAuthSettings.php, you can view it here:

    CASAuthSettings.php

    Direct link </_downloads/mediawiki-1.27-compatible/CASAuthSettings.php>

    /_downloads/mediawiki-1.27-compatible/CASAuthSettings.php

  7. Modify the Parsoid configuration for the VisualEditor extension. The Parsoid server running on the virtual machine needs to communicate with the web server on the same machine. To simplify this, Parsoid is configured to connect simply to http://localhost.... For this to work, the protocol must be changed to HTTPS, and Parsoid must be permitted to ignore mismatched SSL certificates, since it will expect a certificate for "localhost", rather than one for DynamicsHJC, NeuroWiki, or NeuroWikiDev. Make the changes by running these commands:

    sudo sed -i '/setMwApi/s|http://|https://|' /etc/mediawiki/parsoid/settings.js
    sudo sed -i '/strictSSL/s|\(\w*\)//\(.*\)|\1\2|' /etc/mediawiki/parsoid/settings.js
    sudo service parsoid restart
  8. Update the patch for MobileFrontend. For now, skip this step during installation.

    Customizing the mobile site navigation menu by downloading a patch file and applying it:

    wget -O /var/www/mediawiki/extensions/MobileFrontend/MobileFrontend_customize-icons.patch https://neurowiki-docs.readthedocs.io/en/latest/_downloads/MobileFrontend_customize-icons.patch
    patch -d /var/www/mediawiki/extensions/MobileFrontend < /var/www/mediawiki/extensions/MobileFrontend/MobileFrontend_customize-icons.patch

    If you are curious about the contents of the patch file, you can view it here:

    MobileFrontend_customize-icons.patch

    Direct link </_downloads/mediawiki-1.27-compatible/MobileFrontend_customize-icons.patch>

    /_downloads/mediawiki-1.27-compatible/MobileFrontend_customize-icons.patch

  9. Explain the function of NewArticleTemplate better here and in terms of the subpages actually used by students.

    Modify the NewArticleTemplate extension so that subpage templates will be used even if the parent page does not exist.

    For example, without this modification, a new page User:Foo/Bar will use the User namespace subpage template MediaWiki:NewArticleTemplate/User/Subpage if the parent page User:Foo already exists, but it will use the User namespace template MediaWiki:NewArticleTemplate/User if User:Foo does not already exist.

    This modification will force the subpage template to always be used for subpages, regardless of whether the parent page exists or not.

    Download a patch file and apply it:

    wget -O /var/www/mediawiki/extensions/NewArticleTemplate/NewArticleTemplate_always-use-subpage-template.patch https://neurowiki-docs.readthedocs.io/en/latest/_downloads/NewArticleTemplate_always-use-subpage-template.patch
    patch -d /var/www/mediawiki/extensions/NewArticleTemplate < /var/www/mediawiki/extensions/NewArticleTemplate/NewArticleTemplate_always-use-subpage-template.patch

    If you are curious about the contents of the patch file, you can view it here:

    NewArticleTemplate_always-use-subpage-template.patch

    Direct link </_downloads/mediawiki-1.27-compatible/NewArticleTemplate_always-use-subpage-template.patch>

    /_downloads/mediawiki-1.27-compatible/NewArticleTemplate_always-use-subpage-template.patch

    Add hooks to NewArticleTemplate so that it works with VisualEditor.

    Fork NewArticleTemplate on GitHub and incorporate the "always use subpage template" patch and the hooks for VisualEditor.

  10. Fix a bug in the Realnames extension (version 0.3.1)2. The Realnames extension includes a bug that causes subpages in the User namespace to lack titles. Download a patch file and apply it:

    wget -O /var/www/mediawiki/extensions/Realnames/Realnames_ignore-subpage-titles.patch https://neurowiki-docs.readthedocs.io/en/latest/_downloads/Realnames_ignore-subpage-titles.patch
    patch -d /var/www/mediawiki/extensions/Realnames < /var/www/mediawiki/extensions/Realnames/Realnames_ignore-subpage-titles.patch

    If you are curious about the contents of the patch file, you can view it here:

    Realnames_ignore-subpage-titles.patch

    Direct link </_downloads/mediawiki-1.27-compatible/Realnames_ignore-subpage-titles.patch>

    /_downloads/mediawiki-1.27-compatible/Realnames_ignore-subpage-titles.patch

    Fork Realnames on GitHub and incorporate the "ignore subpage titles" patch.

  11. Fix a bug in the MediaWiki core that causes Lockdown to conflict with certain API calls3. In particular, this patch is needed to prevent the "Marking as patrolled failed" error and a silent failure when using the action=userrights API module. Download a patch file and apply it:

    wget -O /var/www/mediawiki/includes/user/Lockdown_api-compatibility.patch https://neurowiki-docs.readthedocs.io/en/latest/_downloads/Lockdown_api-compatibility.patch
    patch -d /var/www/mediawiki/includes/user < /var/www/mediawiki/includes/user/Lockdown_api-compatibility.patch

    If you are curious about the contents of the patch file, you can view it here:

    Lockdown_api-compatibility.patch

    Direct link </_downloads/mediawiki-1.27-compatible/Lockdown_api-compatibility.patch>

    /_downloads/mediawiki-1.27-compatible/Lockdown_api-compatibility.patch

  12. Give the web server ownership of and access to the new files:

    sudo chown -R www-data:www-data /var/www/
    sudo chmod -R ug+rw /var/www/
  13. Download and install the extension configuration settings:

    wget -P ~ https://neurowiki-docs.readthedocs.io/en/latest/_downloads/LocalSettings_extensions.php
    cat ~/LocalSettings_extensions.php >> /var/www/mediawiki/LocalSettings.php
    rm ~/LocalSettings_extensions.php

    If you are curious about the contents of the configuration file, you can view it here:

    LocalSettings_extensions.php

    Direct link </_downloads/mediawiki-1.27-compatible/LocalSettings_extensions.php>

    /_downloads/mediawiki-1.27-compatible/LocalSettings_extensions.php

    Post my solution for the VisualEditor + Lockdown extension conflict to the discussion board, and then provide a "This solution is documented here" footnote in these instructions.

  14. Create database tables for the Math and ScholasticGrading extensions:

    php /var/www/mediawiki/maintenance/update.php
  15. Create aliases for URLs to the surveys and simulations using "interwiki" links. Interwiki links allow MediaWiki sites to easily create links to one another. For example, using [[wikipedia:Neuron]] on our wiki will create a link directly to the Wikipedia article on neurons. Here we use this capability to create aliases, such as [[survey:1]], that make linking to the surveys and simulations easier.

    Run the following (you will be prompted for the MySQL password twice):

    echo "INSERT INTO interwiki (iw_prefix,iw_url,iw_api,iw_wikiid,iw_local,iw_trans) VALUES ('survey','/django/survey/\$1/','','',0,0)" | mysql -u root -p wikidb
    echo "INSERT INTO interwiki (iw_prefix,iw_url,iw_api,iw_wikiid,iw_local,iw_trans) VALUES ('sim','/JSNeuroSim/simulations/\$1.html','','',0,0)" | mysql -u root -p wikidb
  16. Create a script for toggling the locked state of the wiki by downloading and installing a file:

    sudo wget -O /usr/local/sbin/lock-wiki https://neurowiki-docs.readthedocs.io/en/latest/_downloads/lock-wiki
    sudo chmod +x /usr/local/sbin/lock-wiki

    If you are curious about the contents of the script, you can view it here:

    lock-wiki

    Direct link </_downloads/misc/lock-wiki>

    /_downloads/misc/lock-wiki

  17. At this point, individuals with CWRU accounts can log into the wiki, which will create a wiki account for them. Invite the TAs to do this now. After their accounts are created, you should visit (while logged in)

    https://dynamicshjc.case.edu:8014/wiki/Special:UserRights

    For each TA, enter their wiki user name (which should match their CWRU user name), and add them to the following groups:

    • administrator
      • Administrators have special powers on the wiki, such as moving, deleting, or protecting pages.
    • bureaucrat
      • Bureaucrats have the ability to change group membership (using the Special:UserRights page) for any user, including administrators and other bureaucrats (making this the most powerful group).
    • grader
      • Graders can view and edit all grades on the Special:Grades page.

    Add yourself to the grader group as well (you should already be a member of the other groups).

  18. Check that all extensions are installed and working properly. Visit Special:Version and compare the list of installed extensions to the list of extensions at the beginning of this section of the instructions.

    You can test each of the essential extensions by doing the following:

    Extension Test
    CASAuthentication log in using CWRU's Single Sign-On
    EmbedVideo try adding {{#ev:youtube|8zRtXBrmvyc||center|Survival Guide}} to a page
    ImportUsers visit Special:ImportUsers
    Lockdown remove yourself from the administrator group using Special:UserRights and try editing a policy page (restore privileges when done!)
    Math try adding <math>x=\sqrt{2}</math> to a page
    MobileFrontend click the "Mobile view" link at the bottom of any page (click "Desktop" to return to normal)
    NewArticleTemplate will test later...
    Realnames log in and look for your full name in the top right of the page
    ScholasticGrading visit Special:Grades
    UserMerge visit Special:UserMerge
    VisualEditor enable VE under Preferences > Editing, and then try editing a page by clicking "Edit" (not "Edit source")

    Embedded videos don't render in VisualEditor. Fix?

    When attempting to upload files through VisualEditor, it thinks I'm not logged in. Fix!

  19. Shut down the virtual machine:

    sudo shutdown -h now
  20. Using VirtualBox, take a snapshot of the current state of the virtual machine. Name it "MediaWiki extensions installed".

Footnotes


  1. This extension creates a Special page, Special:ImportUsers. After using it, run :

    php /var/www/mediawiki/maintenance/initSiteStats.php

    to update the user count displayed on the wiki statistics page, Special:Statistics ("Active users" will change to "-1" after the script is run, but this will correct itself the next time an edit is made on the wiki).

  2. This solution is documented here.

  3. This issue is described here, and this patch (used in these instructions) was proposed for fixing it. Later, another patch was proposed, but I have not tested it since the first one works for our purposes. One or both of these patches was expected to be included in 1.27.2+, but as of July 2017 the bug is reported to still be present.