Status: | effective |
Progress: | 100% |
Version: | 3.1.0+ |
Installation 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: | Composer |
MediaWiki version: | 1.25.0 and later |
Table of Contents | |
Contents |
Fresh install[edit]
Use these instructions for a new Semantic MediaWiki installation in chronological order as they appear on this page.
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]
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.1"
Remember to add a comma to the end of the preceding line in this section. See an example "composer.local.json" file.
"~3.1"
with "~4.2"
(latest stable release) etc. Please always omit the bugfix release number, i.e. the third digit. 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
--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]
wfLoadExtension( 'SemanticMediaWiki' );
to LocalSettings.php !Until SMW 3.2.x only enableSemantics( 'example.org' );
was used to invoke SMW.
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' );
Starting with Semantic MediaWiki 3.1.0Released on 23 September 2019 and compatible with MW 1.31.0 - 1.33.x. an informative error description page will be shown if this was forgotten for some reason.3
require_once ( … );
, wfLoadExtension( … );
or wfLoadExtensions( … );
must not be added to invoke Semantic MediaWiki.
Add optional settings4 apart from one exception namely configuration parameter $smwgNamespaceIndex
Sets the index of the first namespace to be used by Semantic MediaWiki5 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.
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:7
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:8
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]
- Help page on upgrading from SMW 2.5 and later for MW 1.25 and later
- Help page on upgrading from SMW 1.9 and later for MW 1.22 and later
See also[edit]
- Example "composer.local.json" file
- Help page on the
enableSemantics()
function - Help page on extension registration
- Help page on maintenance script "setupStore.php"Allows to set up the data backend/store
- Help page on maintenance script "rebuildData.php"Allows to rebuild all the semantic data for a selected data backend/store
References
- ^ 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"
- a b c d e This is the directory which contains the "LocalSettings.php" file.
- ^ Semantic MediaWiki: GitHub pull request gh:smw:4153
- ^ 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
$smwgNamespaceIndex
to something other than the default value of100
, you must do this above the enableSemantics() line instead. Make sure that the value set is ≥100
as well as an even number. - ^ Semantic MediaWiki: GitHub pull request gh:smw:1732
- ^ In case you installed Composer "globally" on your server, you will have to drop the
php
and.phar
particles from the command. - ^ rebuildData.php is an optional step to take to assure that the semantic store is valid and up to date