Help:Installation/Using Composer with MediaWiki 1.22 - 1.24

From semantic-mediawiki.org
< Installation
Administrator manualInstallationHelp:Installation/Using Composer with MediaWiki 1.22 - 1.24
Installation
This pages describes the installation using native Composer support for MediaWiki 1.22 - 1.24
Further Information
Installation type: new
Installation method: Composer
MediaWiki version:
Table of Contents

Install[edit]

Use these instructions for a new SMW installation.

  1. Install Composer - please follow the instructions at installing Composer to do this.
  2. Check your MediaWiki version on special page "Special:Version" to ensure compatibility. See also Update to the appropriate version of MediaWiki.
  3. Run the installation script[1] from the base directory[2] of your MediaWiki installation:[3]
    php composer.phar require mediawiki/semantic-media-wiki "~2.1"
    
    NoteNote:  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.1" by "~4.1" etc. Please always omit the bugfix release number, i.e. the third number.
  4. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
    
  5. 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.
  6. Add optional settings[4] apart from one exception[5] to the "LocalSettings.php" file as desired below the enableSemantics() call.
  7. In case you want to use additional semantic extensions which are not installed via Composer like e.g. Extension "Semantic Drilldown" you still have to invoke them by adding the respective line require_once … to you "LocalSettings.php" file below the enableSemantics() call.
  8. See the page "Special:Version" on your wiki to verify that the extension is successfully installed.
  9. Test your installation as described on the help page about testing SMW.
  10. Done!

Update[edit]

Use these instructions to update an existing SMW installation.

  1. Backup your database and installation.
  2. Run the update script from the base directory[2] of your MediaWiki installation:[3]
    php composer.phar update
    
  3. See the page "Special:Version" on your wiki to verify that the extension was successfully updated.
  4. Run the setup script from the base directory[2] of your MediaWiki installation:
    php maintenance/update.php
    
  5. Run the refresh database script from the base directory[2] of your MediaWiki installation:[6]
    php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -d 50 -v
    
  6. Done!

MW 1.25+[edit]

Starting with MW 1.25+ MediaWiki itself uses Composer to facilitate components and packages. In case you see the following message [RuntimeException] The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages. when trying to run composer require ..., you first have to execute composer install before you are able to add extensions via Composer. See also the help page on installing SMW on MediaWiki 1.25.+.

Upgrade[edit]

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

See also[edit]

References[edit]

  1. 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 install" or "php composer.phar install", as that page states, you should call "composer install --prefer-source" or "php composer.phar install --prefer-source".
  2. 2.0 2.1 2.2 2.3 2.4 This is the directory which contains the "LocalSettings.php" file.
  3. 3.0 3.1 In case you installed Composer "globally" on your server, you will have to drop the php and .phar particles from the command.
  4. 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.
  5. 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.
  6. This is an optional step to take to assure that the semantic store is valid and up to date.


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