$smwgConfigFileDir

From semantic-mediawiki.org


Configuration parameter details:
Name $smwgConfigFileDir
Description Sets the directory for storing the setup information file ensuring database consistency
Default setting
__DIR__
Software Semantic MediaWiki
Since version
Until version
Configuration Installation
Keyword installation · upgrade · database consistency


$smwgConfigFileDir is a configuration parameter that sets the directory for storing the setup information file ".smw.json" which is holding the upgrade key which verifies and ensures that the upgrade of the database was done correctly, i.e. by running maintenance script "setupStore.php"Allows to set up the data backend/store or maintenance script "update.php" (MediaWiki.org) respectively. It was introduced in Semantic MediaWiki 3.0.1Released on 25 January 2019 and compatible with MW 1.27.0 - 1.31.x.1.

Deprecated since Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. and will be removed in Semantic MediaWiki 8.0.0Released on an unknown date and compatible with unknown versions of MediaWiki.. As of Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. the install-state metadata (upgrade key, maintenance mode, version tracking, last optimization run, entity collation and similar) is stored in the smw_meta database table instead of the .smw.json file, so a shared filesystem is no longer required for multi-server setups. This setting is now only consulted by the one-shot migration that runs during maintenance script "update.php" (MediaWiki.org): if a pre-existing .smw.json file is found at this location its entries are imported into smw_meta and the file is renamed to .smw.json.migrated. Sites that previously overrode this setting (for example to $wgUploadDirectory) should keep the override in place until update.php has run once.2
The path for for storing the setup information file for verifying and ensuring database consistency must be writable, persistent and accessible for Semantic MediaWiki throughout its operation.

Default setting[edit]

$smwgConfigFileDir = __DIR__;

This means that by default the setup information file ".smw.json" will be stored in the root directory of the Semantic MediaWiki Software, i.e. /path/to/extensions/SemanticMediaWiki.

Changing the default setting[edit]

As of Semantic MediaWiki 7.0.0Released on 4 June 2026 and compatible with MW 1.43.x - 1.46.x. this setting only affects where the one-shot update.php migration looks for a pre-existing .smw.json file. It has no further effect once the file has been migrated to the smw_meta table.

To modify the setting to this configuration parameter, add one of the following lines to your "LocalSettings.php" file:

Change the standard directory to store the file to the base directory of the wiki
$smwgConfigFileDir = $IP;

This means that the setup information file ".smw.json" will be stored in the base directory for the wiki3, e.g. /path/to/wiki.

Change the standard directory to store the file to a completely different directory
$smwgConfigFileDir = /usr/local/bin/smw;

This means that the setup information file ".smw.json" will be stored in /usr/local/bin/smw.

In a farmed multi wiki environment something like the following is possible, too to allow differentiating between individual wikis:
$smwgConfigFileDir = __DIR__ . "/../.config/{$wgDBname}";

See also[edit]


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:3596
  2. ^  | |  Semantic MediaWiki: GitHub pull request gh:smw:6892
  3. ^  This is the directory which contains the "LocalSettings.php" file.