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.0.0Released on an unknown date and compatible with unknown versions of MediaWiki., enableSemantics() is deprecated and its loadDefaultConfigFrom() / loadConfigFrom() methods are no longer available. Use require statements instead. See updated usage below.

Profiles[edit]

Default profiles[edit]

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

In future it should be easily possible to provide other profiles to help users more quickly to adapt their installation without having to identify each single configuration necessary to enable a certain aspect of the software.

Custom profiles[edit]

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 (7.0.0+)[edit]

Load profiles with require after wfLoadExtension:

Default profiles[edit]

wfLoadExtension( 'SemanticMediaWiki' );
require "$IP/extensions/SemanticMediaWiki/data/config/developer.php";
require "$IP/extensions/SemanticMediaWiki/data/config/media.php";

Custom profiles[edit]

wfLoadExtension( 'SemanticMediaWiki' );
require __DIR__ . '/path/to/file/myCustomConfiguration.php';

Usage (prior to 7.0.0)[edit]

Default profiles[edit]

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[edit]

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'
);

Note[edit]

As with any configuration that is added to the "LocalSettings.php" file, the loading sequence is important. Adding something before or after a certain will have an effect of how the configuration is treated. This means that a configuration added via a configuration profile will be overridden by any configuration of the same name that is added after the profile is loaded.

See also[edit]

References

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