Jump to content

Manual:$wgFileStore

From mediawiki.org
Files and file uploads: $wgFileStore
File storage paths; currently used only for deleted files.
Introduced in version:1.7.0 (r14777)
Deprecated in version:1.17.0 (r69007)
Removed in version:1.24.0 (Gerrit change 145738; git #5842d0aa)
Allowed values:see below
Default value:see below

Details

File storage paths; was last used only for deleted files.

The setting contains an array of arrays. The first index is the name of the type of file being stored (currently only 'deleted' is valid) and the second index is one of the following three keys:

  • 'directory' contains the directory on the server where the files will be saved. As of version 1.17, this is superseded by $wgDeletedDirectory .
  • 'url' contains the URL used to access the file over the internet.

If the file is private (as for deleted files) this should be null. As of version 1.23, this value is ignored.

  • 'hash' contains the number of levels of subdirectory to create under the specified directory. E.g. if you set this to 3, images will be stored in paths such as /a/b/a/Abacus.jpg (relative to the above directories).

As of version 1.17, this is superseded by $wgHashedUploadDirectory .

Default values

MediaWiki versions:
1.11 – 1.23

Deleted images are stored by default in "$wgUploadDirectory /deleted". $wgFileStore can be used to customize this:

The default settings are:

$wgFileStore['deleted']['directory'] = false;// Defaults to $wgUploadDirectory/deleted
$wgFileStore['deleted']['url'] = null;       // Private, so set to null
$wgFileStore['deleted']['hash'] = 3;         // 3-level subdirectory split
MediaWiki versions:
1.7 – 1.10

Prior to MediaWiki 1.11, deleted files are simply discarded by default; see $wgSaveDeletedFiles for how to enable storing them. To enable undeletion, the 'deleted directory' must be defined and $wgSaveDeletedFiles must be true.

The default settings are:

$wgFileStore = array();
$wgFileStore['deleted']['directory'] = null; // Don't forget to set this.
$wgFileStore['deleted']['url'] = null;       // Private
$wgFileStore['deleted']['hash'] = 3;         // 3-level subdirectory split

Example

An example enabling saving deleted images:

$wgSaveDeletedFiles = true;                                    // Not required in MW 1.11.0 and above.
$wgFileStore['deleted']['directory'] = "$IP/imagesDeleted";
$wgFileStore['deleted']['url'] = null; 
$wgFileStore['deleted']['hash'] = 3;

The 'deleted url' can remain null (as the deleted files are private, not visible to the Internet).

See also