Help:Installation/Windows environment

From semantic-mediawiki.org
Jump to: navigation, search
InstallationHelp:Installation/Windows environment
Installation
Installing Semantic MediaWiki on a Windows Server.
Further Information
Installation type:
Installation method:
Table of Contents

Installing Semantic MediaWiki as of version 1.9 on a Windows Server will require a different approach on what most of you are used to. Because of ever increasing dependencies within SMW it has become more difficult to get a stable version up and running. Especially when you want to or are used to run the development version of SMW. Because of that Composer is required when installing SMW 1.9 and higher. These instruction explain how to install SMW as of 1.9 on a Windows box using Composer.

Platform compatibility

The compatibility table is there for reference only. If you want to install SMW as explained on this page (with Composer) you need to run SMW 1.9 as a minimum.

SMW versionRelease datePHPMediaWikiComposerValidator
Semantic MediaWiki 2.4.112 July 2016
Semantic MediaWiki 2.4.09 July 2016
Semantic MediaWiki 2.3.14 January 20165.3.2 - 5.6.x & HHVMMW 1.19.0 - 1.25.xRequired2.0.x (handled by Composer)

Relational database support

SMW versionMySQLSQLitePostgreSQL
Semantic MediaWiki 2.4.1
Semantic MediaWiki 2.4.0
Semantic MediaWiki 2.3.15.x3.x9.x

Requirements

You need a running (working) Wiki. Consider updating MediaWiki to the latest stable version on a existing Wiki. When you are installing / updating SMW on existing Wiki back up your Wiki and its DB first! Before you start installing SMW you will need the following software / extension(s) to be installed on your Wiki server. Only start installing SMW when you have done this. Your server also needs to be connected to the Internet.

Program
Extension
description Remark
Composer Dependency Manager for PHP
Git Distributed version control system Note Note: At this moment Git is still required to install SMW. In the future it will be possible to use Composer without having Git installed!
Extension Installer MediaWiki extension Use only for MediaWiki 1.19 / 1.20 and 1.21 to install extensions with Composer [1]. You do not need Extension Installer when you are using MediaWiki 1.22 or later.

Install Composer

Download the installer from http://getcomposer.org/Composer-Setup.exe and run it. The installer will download composer for you and set up your PATH environment variable so you can simply call composer from any directory.

Install Git

Download the installer from http://git-scm.com/download/win and run the installer.

Install Extension Installer

Note Note: You do not need Extension Installer when you are using MediaWiki 1.22 or later!

Download Extension Installer from the MediaWiki wiki and follow the instructions on how to install.

Install / Update SMW with Composer

When using Composer to install extensions there is no need to edit LocalSettings.php to enable them. All extensions that support Composer will auto-load. MediaWiki provides direct support for composer as of version 1.22! However, you can edit LocalSettings.php after setup to change extension settings, see Help:Configuration.

When you are installing SMW on a fresh MW installation start at step 3.

  1. Delete all required extensions for SMW from the extensions directory of your wiki installation these are:
    • SemanticMediaWiki
    • Validator
    • DataValues
  2. Delete all lines from required SMW extensions from Localsettings.php that load SMW, they are no longer needed. These are:
    require_once( "$IP/extensions/DataValues/DataValues.php" );
    require_once( "$IP/extensions/Validator/Validator.php" );
    include_once( "$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php" );
  3. Add the following line(s) to the end of your LocalSettings.php file:
    $smwgNamespaceIndex = ???; /** Keep $smwgNamespaceIndex when set to a non default value. Should be before enableSemantics! Not necessary on a fresh MW installation. */
    enableSemantics('your.wiki.blabla'); /** Adjust to yours.*/
  4. In a terminal screen cd to the root of your wiki and execute the following commands:
    • For the latest stable SMW release use: composer require mediawiki/semantic-media-wiki"~2.4"
    • For the SMW development version use: composer require mediawiki/semantic-media-wiki "dev-master"
  5. In a terminal screen cd to the maintenance directory of you wiki and run php update.php to update your database.
  6. On an existing wiki you could rebuild your semantics. Note Note: Please read Help:Repairing SMW's data first so you know what this will do! cd to extensions\SemanticMediaWiki\maintenance and execute the refreshData php script:
    • php SMW_refreshData.php -f -d 50 -v


If you already have SMW installed via Composer, upgrading to a new version can be as simple as running "composer update". However, you may need to modify your Composer.json file first to specify which version of SMW you want installed.

Windows does not always recognize the changes made by Composer. In order to make SMW work after an upgrade, you may need to update the "modified date" of each file in the extensions/SemanticMediaWiki directory. To do this you need a bash emulator (e.g. a terminal where you can use Unix commands). If you have Git installed (which you need to use Composer) you probably have Git Bash. In your bash emulator change directory to the MediaWiki extensions directory, then run:

find SemanticMediaWiki/. -exec touch {} \;

This will find every file and directory in the SemanticMediaWiki directory and execute the "touch" command, updating it's modification date.

Install / Update SMW extensions that support Composer

You can, if you need them, install some SMW extension with Composer. When you are installing SMW on a fresh MW installation or you never used these extension before go to step 3.

  1. In explorer delete all older SMW extensions from the extensions directory of your wiki installation. These are:
    • Maps
    • SemanticMaps
    • SemanticResultFormats
  2. Delete all lines from SMW extensions from Localsettings.php that load SMW extensions, they are no longer needed. These are:
    require_once( "$IP/extensions/Maps/Maps.php" );
    require_once( "$IP/extensions/SemanticMaps/SemanticMaps.php" );
    include_once( "$IP/extensions/SemanticResultFormats/SemanticResultFormats.php" );
  3. In a terminal screen cd to the root of your wiki and execute the following commands to install the extensions you need:
    composer require mediawiki/maps "*"
    composer require mediawiki/semantic-maps "*" Note Note: You need to install Maps first!
    composer require mediawiki/semantic-result-formats "*"

Install / Update other SMW extensions through Git

You can also install these extensions by downloading them from MediaWiki. When you are using Git, in a terminal screen cd to the extensions directory of your wiki and execute the following commands for the extensions you need or want to update, some examples below:

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticForms.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticFormsInputs.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticDrilldown.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/AdminLinks.git
...

Of course, you then have to edit LocalSettings.php to enable these extensions. For documentation on this look on the individual extension pages on the MediaWiki wiki.

Downgrading

If for some reason you need to downgrade from one Composer-supported version of SMW to another Composer-supported version, perform the following:

  1. Update Composer.json to the state the specific version of SMW you want installed (e.g. "2.0" is specific, versus "~2.0" will install the latest version less than 3.0).
  2. Run "composer update"
  3. You may need to run "composer dump-autoload --optimize"

References

  1. https://www.mediawiki.org/wiki/Composer#See_also