Upgrade from SMW 4.2.x to SMW 5.0.x (MW 1.39.0 to MW 1.43.x)

From semantic-mediawiki.org
< Help:Upgrade
Administrator manualInstallationUpgradeUpgrade from SMW 4.2.x to SMW 5.0.x (MW 1.39.0 to MW 1.43.x)
Installation
This page describes the upgrade procedure from SMW 4.2.x to SMW 5.0.x
Further Information
Installation type: upgrade
Installation method: Composer
MediaWiki version: 1.39.0 to 1.43.x
Table of Contents

This help page describes the upgrade procedure from Semantic MediaWiki 4.2.x to Semantic MediaWiki 5.0.x with native Composer support.

Step 1 - Check compatibility[edit]

Check the compatibility of your environment with Semantic MediaWiki, most notably the compatibility with MediaWiki and PHP. For detailed information, see the help page on compatibility.

Step 2 - Backup database and wiki[edit]

Backup your wiki database and wiki installation.

Step 3 - Update setup file[edit]

Change to the base directory of your wiki1 in your server's shell and modify the "composer.local.json" file to look like this2 or contains "mediawiki/semantic-media-wiki": "~5.0.0":

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

Step 4 - Update Semantic MediaWiki[edit]

Run the composer command34 from the base directory of your wiki1 in your server's shell to upgrade the source code of Semantic MediaWiki and dependencies:

php composer.phar update --no-dev

Step 5 - Invoke Semantic MediaWiki[edit]

Make sure that you have the following lines in your "LocalSettings.php" file:

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

Note that "example.org" should be replaced by your wiki's domain.

Step 6 - Check for breaking changes in Semantic MediaWiki[edit]

Semantic MediaWiki 5.0.0Released on 10 March 2025 and compatible with MW 1.39.0 - 1.43.x. comes with breaking changes.

Data backend[edit]

Breaking changes for users of ElasticStore or the SPARQLStore as store for the semantic data.

Update your setting to configuration parameter $smwgDefaultStoreSets the storage backend to be used for the semantic data:
$smwgDefaultStore = 'SMW\Elastic\ElasticStore';

or

$smwgDefaultStore = 'SMW\Elastic\SPARQLStore';

If you use the default SQLStore, you must not set $smwgDefaultStore explicitly, i.e., remove the configuration parameter from your "LocalSettings.php" file.

Search backend[edit]

Breaking changes for users of the SMWSearch feature. Currently, you can no longer use it. To avoid the issue, you need to remove SMWSearch form configuration parameter $wgSearchType (MediaWiki.org) in your "LocalSettings.php" file if you are using it.5

Step 7 - Update database[edit]

Run maintenance script "update.php" (MediaWiki.org) from the base directory of your wiki1 in your server's shell to apply the schema changes to your wiki's database:

php maintenance/update.php

Or alternatively use maintenance script "setupStore.php"Allows to set up the data backend/store:

php extensions/SemanticMediaWiki/maintenance/setupStore.php

Done![edit]

Semantic MediaWiki and the database use should now be appropriately upgraded. The wiki may now be used again.

See also[edit]


References

  1. a b c  This is the directory which contains the "LocalSettings.php" file.
  2. ^  | |  This help page assumes that your are only upgrading Semantic MediaWiki. In case you installed further extensions to Semantic MediaWiki the "composer.local.json" needs to be adapted accordingly. See an example.
  3. ^  | |  In case you installed Composer "globally" on your server, you will have to drop the php and .phar particles from the command.
  4. ^  | |  This help page assumes that the "composer.phar" file is located in the base directory of your wiki. If not the path to the "composer.phar" file needs to be adapted to the server's situation.
  5. ^  Semantic MediaWiki: GitHub issue gh:smw:5782