From 2cec654eea1b28789585c42c48258c24b36e2a56 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 31 Jan 2013 22:06:57 -0800 Subject: [PATCH] [FileBackend] Added more documentation. Change-Id: I6a0f0dc253fbe82a58345d4179248071062286ff --- includes/DefaultSettings.php | 32 ++++++++++++++++++++++------ includes/filebackend/FileBackend.php | 1 + 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 2808996636..0f49843b20 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -438,14 +438,34 @@ $wgUseInstantCommons = false; /** * File backend structure configuration. + * * This is an array of file backend configuration arrays. * Each backend configuration has the following parameters: - * - 'name' : A unique name for the backend - * - 'class' : The file backend class to use - * - 'wikiId' : A unique string that identifies the wiki (container prefix) - * - 'lockManager' : The name of a lock manager (see $wgLockManagers) - * - * Additional parameters are specific to the class used. + * - 'name' : A unique name for the backend + * - 'class' : The file backend class to use + * - 'wikiId' : A unique string that identifies the wiki (container prefix) + * - 'lockManager' : The name of a lock manager (see $wgLockManagers) + * + * See FileBackend::__construct() for more details. + * Additional parameters are specific to the file backend class used. + * These settings should be global to all wikis when possible. + * + * There are two particularly important aspects about each backend: + * - a) Whether it is fully qualified or wiki-relative. + * By default, the paths of files are relative to the current wiki, + * which works via prefixing them with the current wiki ID when accessed. + * Setting 'wikiId' forces the backend to be fully qualified by prefixing + * all paths with the specified value instead. This can be useful if + * multiple wikis need to share the same data. Note that 'name' is *not* + * part of any prefix and thus should not be relied upon for namespacing. + * - b) Whether it is only defined for some wikis or is defined on all + * wikis in the wiki farm. Defining a backend globally is useful + * if multiple wikis need to share the same data. + * One should be aware of these aspects when configuring a backend for use with + * any basic feature or plugin. For example, suppose an extension stores data for + * different wikis in different directories and sometimes needs to access data from + * a foreign wiki's directory in order to render a page on given wiki. The extension + * would need a fully qualified backend that is defined on all wikis in the wiki farm. */ $wgFileBackends = array(); diff --git a/includes/filebackend/FileBackend.php b/includes/filebackend/FileBackend.php index 65caf108fc..8c0ce88449 100644 --- a/includes/filebackend/FileBackend.php +++ b/includes/filebackend/FileBackend.php @@ -77,6 +77,7 @@ abstract class FileBackend { * This should consist of alphanumberic, '-', and '_' characters. * This name should not be changed after use. * - wikiId : Prefix to container names that is unique to this wiki. + * If not provided, this defaults to the current wiki ID. * It should only consist of alphanumberic, '-', and '_' characters. * - lockManager : Registered name of a file lock manager to use. * - fileJournal : File journal configuration; see FileJournal::factory(). -- 2.20.1