Installation with shell access using Composer (MediaWiki 1.25+)

From semantic-mediawiki.org
Jump to: navigation, search
InstallationInstallation with shell access using Composer (MediaWiki 1.25+)
Installation
This pages describes the installation using native Composer support for MediaWiki 1.25+
Image / Video collection
Further Information
Installation type: new
Installation method: Composer
mediawikiMinVersion: 1.25
Table of Contents

Fresh install

Use these instructions for a new Semantic MediaWiki installation in chronological order as they appear on this page.

Install Composer

Install Composer - please follow the instructions at installing Composer to do this.

Check compatibility

"Special:Version" contains the MediaWiki version and it is recommended to compare compatibility with Update to the appropriate version of MediaWiki and COMPATIBILITY.md.

Using Composer

Run the following "initialization" command12 from the base directory3 of your MediaWiki installation:4

php composer.phar require mediawiki/semantic-media-wiki "~2.5" --update-no-dev
or alternatively if Composer is installed globally
composer require mediawiki/semantic-media-wiki "~2.5" --update-no-dev
Important noteImportant Note: The version stated in the line above is provided as an example. See the Releases page on GitHub for newer releases. If there is e.g. a release called "SMW 2.2.0" you will have to replace "~2.5" with "~2.5" (latest stable release) etc. Please always omit the bugfix release number, i.e. the third number with additional information about the ~ usage can be found here.

NoteNote:  MediaWiki 1.25+ itself started to facilitate the use of composer.json for its own library dependency management therefore it has been suggested by MW5 to use composer.local.json to add local packages to avoid merge conflicts with subsequent software updates. Since composer.local.json is a MediaWiki specific convention, composer require cannot be expected to work on this file and instead has to be edited manually.

Run maintenance script

Run the setup script from the base directory3 of your MediaWiki installation:
php maintenance/update.php

Enable Semantic MediaWiki

Add a call to enableSemantics() to the end of the "LocalSettings.php" file. enableSemantics() takes in the domain name of the wiki; a wiki located at "example.org", for instance, should have the following call:

enableSemantics( 'example.org' );

The calls require_once … must neither be added for Semantic MediaWiki nor for Validator since Composer loads the extensions automatically.

Add optional settings6 apart from one exception namely the $smwgNamespaceIndex7 to the "LocalSettings.php" file as desired below the enableSemantics() call.

In case you want to use additional semantic extensions which are not installed via Composer like e.g. Semantic Drilldown you still have to invoke them by adding the respective line require_once … to you "LocalSettings.php" file below the enableSemantics() call.

Check and verify

Check the "Special:Version" page on your wiki and verify that the extension has been successfully installed and enabled.

Test your installation as described on the help page about testing SMW.

Done!

Update

Use these instructions to update an existing SMW installation.

Backup

Backup your database and installation.

Run Composer update

Run the update script from the base directory3 of your MediaWiki installation:4

php composer.phar update
or alternatively if Composer is installed globally
composer update

Run maintenance script

Run the setup script from the base directory3 of your MediaWiki installation:

php maintenance/update.php

Run the refresh database script from the base directory3 of your MediaWiki installation:8

php extensions/SemanticMediaWiki/maintenance/rebuildData.php -d 50 -v

Check and verify

Check the "Special:Version" page on your wiki and verify that the extension has been successfully updated.

Done!

Upgrade

See the help page on upgrading from SMW 1.9+ for MW 1.22+

See also


This documentation page applies to all SMW versions from 2.0 to the most current version.
      Other languages: fr

Help:Installation/Using Composer with MediaWiki 1.25+ en 2.0


References

  1. ^  This is necessary since starting with MW 1.25+ MediaWiki MediaWiki itself uses Composer to facilitate components and packages.
  2. ^  Note that, if you have Git installed, it's recommended to install composer with the "--prefer-source" flag, so that Composer uses Git to download the code. In other words, instead of calling "composer update" or "php composer.phar update", as that page states, you should call "composer update --prefer-source" or "php composer.phar update --prefer-source".
  3. a b c d e  This is the directory which contains the "LocalSettings.php" file.
  4. a b  In case you installed Composer "globally" on your server, you will have to drop the php and .phar particles from the command.
  5. ^  Using composer-merge-plugin to "... allow local installs to use Composer to load optional libraries and/or manage extensions with Composer ... local deployment to add required extensions and libraries to a file composer.local.json inside the root MediaWiki directory"
  6. ^  See the help page on configuring SMW. Usually only a few configuration parameters have to be changed if there is a need to do so at all.
  7. ^  If you manually set $smwgNamespaceIndex to something other than the default value of 100, you must do this above the enableSemantics() line instead. Make sure that the value set is ≥ 100 as well as an even number.
  8. ^  rebuildData.php is an optional step to take to assure that the semantic store is valid and up to date