Using Composer with MediaWiki 1.25+ (Installation)
|This pages describes the installation using native Composer support for MediaWiki 1.25+|
|Image / Video collection|
|Table of Contents|
Use these instructions for a new Semantic MediaWiki installation in chronological order as they appear on this page.
php composer.phar require mediawiki/semantic-media-wiki "~2.1" --update-no-dev
composer require mediawiki/semantic-media-wiki "~2.1" --update-no-dev
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.4" (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.
Note: 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 scriptRun the setup script from the base directory3 of your MediaWiki installation:
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' );
require_once … must neither be added for Semantic MediaWiki nor for Validator since Composer loads the extensions automatically.
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
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.
Use these instructions to update an existing SMW installation.
Backup your database and installation.
Run Composer update
php composer.phar update
Run maintenance script
Run the setup script from the base directory3 of your MediaWiki installation:
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.
See the help page on upgrading from SMW 1.9+ for MW 1.22+
- Installation commands for Composer
- Example "composer.local.json" file
Help:Installation/Using Composer with MediaWiki 1.25+ en 2.0
- This is necessary since starting with MW 1.25+ MediaWiki MediaWiki itself uses Composer to facilitate components and packages.
- 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".
- This is the directory which contains the "LocalSettings.php" file.
- In case you installed Composer "globally" on your server, you will have to drop the
.pharparticles from the command.
- 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"
- 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.
- If you manually set
$smwgNamespaceIndexto something other than the default value of
100, you must do this above the enableSemantics() line instead. Make sure that the value set is ≥
100as well as an even number.
- rebuildData.php is an optional step to take to assure that the semantic store is valid and up to date