Help:Configuration preloading

From semantic-mediawiki.org
Table of Contents

Configuration preloading was added in Semantic MediaWiki 3.2.0Released on 7 September 2020 and compatible with MW 1.31.0 - 1.35.x.1 as a way to preload reusable configuration profiles, reducing manual setup when creating new wiki instances.

As of Semantic MediaWiki 7.3.0Released on 16 September 2026 and compatible with MW 1.43.x - 1.46.x., default profiles are applied with configuration parameter $smwgConfigProfilesApplies configuration profiles shipped with Semantic MediaWiki.2 The require statements this page recommended for Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. do not apply a default profile's settings, and fail with an error for media.php.

Profiles

Default profiles

The following configuration profiles are provided by default and demonstrate the expected file format:

Custom profiles

In case a wiki environment has common configuration settings that need to be preserved and reused then it is possible to store those in a separate ".php"-file.

Usage

Default profiles

As of Semantic MediaWiki 7.3.0Released on 16 September 2026 and compatible with MW 1.43.x - 1.46.x., list the profiles by name in configuration parameter $smwgConfigProfilesApplies configuration profiles shipped with Semantic MediaWiki:

$smwgConfigProfiles = [ 'developer', 'media' ];

Profiles are applied after the "LocalSettings.php" file, so their settings take precedence over the same settings there. Run maintenance script "update.php" (MediaWiki.org) after enabling or removing db-primary-keys, elastic-fileingest or media. The wiki does not start when a default profile is also loaded with require, so remove such lines.

From Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. to 7.2.x there is no supported way to apply a default profile.

Custom profiles

As of Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x., load a custom profile with require. The file must assign complete values, such as $smwgPageSpecialProperties = [ '_MDAT', '_MIME' ];, instead of returning them:

require __DIR__ . '/path/to/file/myCustomConfiguration.php';

Usage (prior to 7.0.0)

Default profiles

In case a wiki environment wants to make use of default configuration profiles they can be preloaded like, e.g.:

enableSemantics( 'example.org' )->loadDefaultConfigFrom(
    'developer.php',
    'media.php'
);

Custom profiles

In case a wiki environment wants to make use of customized configuration profiles they can be preloaded like, e.g.:

enableSemantics( 'example.org' )->loadConfigFrom(
    __DIR__ . '/path/to/file/myCustomConfiguration.php'
);

See also


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:4684
  2. ^  |  Semantic MediaWiki: GitHub pull request gh:smw:7118

Cookies help us deliver our services. By using our services, you agree to our use of cookies.