This wiki is being moved to a new server and cannot be edited. Please sit tight. Thank you.

Installation with shell access using Composer (MediaWiki 1.25+)

From semantic-mediawiki.org
< Installation
Administrator manualInstallationInstallation with shell access using Composer (MediaWiki 1.25+)
Installation
This pages describes the installation using native Composer support
Image / Video collection
Further Information
Installation type: new
Installation method: Help:Using Composer
MediaWiki version: 1.25.0 and later
Table of Contents

Fresh install[edit]

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

Please also consult our page on troubleshooting in case you encounter issues during the process.

Install Composer[edit]

Install Composer first since this software is required to install Semantic MediaWiki. Please follow the instructions at installing Composer on how to do this.

Check compatibility[edit]

Make sure that you have a compatible version of MediaWiki installed. Special page "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[edit]

MediaWiki 1.25+ itself started to facilitate the use of the "composer.json" file for its own library dependency management. Therefore it is strongly encouraged to use the "composer.local.json" file to add local packages to avoid merge conflicts with subsequent software updates instead of issuing the commands shown below.1

If you do not have a "composer.local.json" file yet, create one and add the following content to it:

{
	"require": {
                  "mediawiki/semantic-media-wiki": "~3.0"
        }
}

If you already have a "composer.local.json" file add the following line to the end of the "require" section in your file:

"mediawiki/semantic-media-wiki": "~3.0"

Remember to add a comma to the end of the preceding line in this section. See an example "composer.local.json" file.

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 3.1.0" you will have to replace "~3.0" with "~3.0" (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.

Run the update script[edit]

Run the installation script from the base directory2 of your MediaWiki installation:

php composer.phar update --no-dev

Note if you have Git installed on your system add the --prefer-source flag to the above command. Also note that it may be necessary to run this command twice. If unsure do it twice right away.

Run the maintenance script[edit]

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

php maintenance/update.php
Add --skip-external-dependencies to the call of the setup script if you get an error message similar to the following one:
mediawiki/semantic-media-wiki: 2.5.0 installed, ~2.5 required.

Enable Semantic MediaWiki[edit]

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 ( … );, wfLoadExtension( … ); or wfLoadExtensions( … );must not be added to invoke Semantic MediaWiki.

Add optional settings3 apart from one exception namely configuration parameter $smwgNamespaceIndexSets the index of the first namespace to be used by Semantic MediaWiki4 to the "LocalSettings.php" file as desired below the enableSemantics() call.

In case you want to use additional semantic extensions please refer to their respective documentation on how to invoke them. In any case make sure that you invoke them below the enableSemantics() call in your "LocalSettings.php" file.

Since Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. MediaWiki's extension registration system is used.5 The loading of the extension is however solely done via the enableSemantics() call.

Check and verify[edit]

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 Semantic MediaWiki.

Done!

Update[edit]

Use these instructions to update an existing Semantic MediaWiki installation.

Backup[edit]

Backup your database and installation.

Run the update script[edit]

Run the update script from the base directory2 of your MediaWiki installation:6

php composer.phar update --no-dev

Note if you have Git installed on your system add the --prefer-source flag to the above command. Also note that it may be necessary to run this command twice. If unsure do it twice right away.

Run the maintenance script[edit]

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

php maintenance/update.php

Run the refresh database script from the base directory2 of your MediaWiki installation:7

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

Check and verify[edit]

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

Done!

Upgrade[edit]

See also[edit]





References

  1. ^  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"
  2. a b c d e  This is the directory which contains the "LocalSettings.php" file.
  3. ^  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.
  4. ^  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.
  5. ^  Semantic MediaWiki: GitHub pull request gh:smw:1732
  6. ^  In case you installed Composer "globally" on your server, you will have to drop the php and .phar particles from the command.
  7. ^  rebuildData.php is an optional step to take to assure that the semantic store is valid and up to date