Installation – Quick Guide

From semantic-mediawiki.org
< Installation
Administrator manualInstallationInstallation – Quick Guide

Composer[edit]

Composer needs to be installed and available first. See Using Composer with MediaWiki and Installing Composer if unsure.

Compatibility[edit]

Please check the compatibility requirements.

Prepare and obtain[edit]

If you do not have a "composer.local.json" file yet, create one in the base directory1 of your MediaWiki installation.

Since you should already have composer installed, you can do this by running composer in the top-level MediaWiki directory. Assuming you have composer.phar in that directory, the following command will work:

 COMPOSER=composer.local.json php composer.phar require --no-update mediawiki/semantic-media-wiki

Alternatively, if the above fails, you can add the following content to your composer.local.json file:

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

See also an example "composer.local.json" file if unsure how to proceed.

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 4.2.0" you will have to replace "~3.2" with "~4.2" to get the latest stable release. Please always omit the bugfix release number, i.e. the third number with additional information about the ~ usage can be found here. (Of course, if you used the command line to create composer.local.json instead of editing it by hand, composer has already selected the latest stable version.)

Now run the following command from the base directory1 of your MediaWiki installation:

composer update --no-dev

Enable[edit]

BREAKING: As of Semantic MediaWiki 4.0.0Released on 18 January 2022 and compatible with MW 1.35.0 - 1.37.x. you need to add wfLoadExtension( 'SemanticMediaWiki' ); to LocalSettings.php !

Until SMW 3.2.x only enableSemantics( 'example.org' ); was used to invoke SMW.

Add a call to wfLoadExtension() as well as 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:

wfLoadExtension( 'SemanticMediaWiki' );
enableSemantics( 'example.org' );

Setup and update[edit]

Run MediaWiki'S "update.php" script from the base directory1 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.

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.


References

  1. a b c  This is the directory which contains the "LocalSettings.php" file.