手册:$wgLocalFileRepo

From mediawiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:$wgLocalFileRepo and the translation is 16% complete.
文件及文件上传: $wgLocalFileRepo
A single repository structure for the local repository.
引进版本:1.11.0 (r22580)
移除版本:仍在使用
允许的值:(数组)
默认值:参见下方

细节

This config is for customizing the local (primary) file repo that MediaWiki uses. Most users will not want to customize this or will customize this indirectly via other variables such as $wgUploadDirectory.

More complex setups may requiring customizing this variable. For example, if you want to use a custom file backend, in order to replicate file storage amongst multiple data centers.

Properties required for all repos

class
The class name for the repository. May come from the core or an extension. The core repository classes are FileRepo, LocalRepo, ForeignDBRepo. (FSRepo is also supported for backwards compatibility.)
name
Should be set to 'local'.
backend
A file backend name (see $wgFileBackends ). For $wgLocalFileRepo and $wgForeignFileRepos , a name is automatically generated in Setup.php if not defined.

General parameters for LocalRepo class

zones
Config of where to store files (different zones like public vs deleted). An array of zone descriptions containing: container, url, directory, urlsByExt. Some other config options may override this one in specific cases
url
Base public URL
hashLevels
The number of directory levels for hash-based division of files (see $wgHashedUploadDirectory for info)
deletedHashLevels
...
thumbScriptUrl
The URL for thumb.php (optional, not recommended)
transformVia404
Whether to skip media file transformation on parse and rely on a 404 handler instead.
thumbProxyUrl
...
thumbProxySecret
...
disableLocalTransform
Do not resize images on local machine, but instead use some other system to do so
initialCapital
Equivalent to $wgCapitalLinks , determines whether filenames implicitly start with a capital letter. The current implementation may give incorrect description page links when the local $wgCapitalLinks and initialCapital are mismatched.
pathDisclosureProtection
May be 'paranoid' to remove all parameters from error messages, 'none' to leave the paths in unchanged, or 'simple' to replace paths with placeholders. Default for LocalRepo is 'simple'.
fileMode
Used by FileBackend to set the unix permissions on created files.
directory
Used by FileBackend to determine upload directory
thumbUrl
URL to server thumbmails from (if not overriden by zone directive)
isPrivate
Is this repo private (E.g. its a private repo). Steps are taken to prevent direct access, but may not be sufficient and you should still make sure the files aren't somewhere served by webserver.
useJsonMetadata
Store serialized metadata as JSON insetad of php-serialized format
useSplitMetadata
Store large chunks of FileMetadata in blob store. Some files have their entire text layer as metadata which can cause memory issues if stored directly on the file
splitMetadataThreshold
threshold above which metadata items should be split into separate storage
updateCompatibleMetadata
Automatically regenerate file metadata if it is detected metadata is out of date
reserializeMetadata
Automatically change metadata format (E.g. to JSON) or split it to separate storage, if it is detected as needed


Default value

This code, in Setup.php, generates a default value for $wgLocalFileRepo based on the values of other configuration settings:

if ( !$wgLocalFileRepo ) { $wgLocalFileRepo = [ 'class' => LocalRepo::class, 'name' => 'local', 'directory' => $wgUploadDirectory , 'scriptDirUrl' => $wgScriptPath , 'url' => $wgUploadBaseUrl  ? $wgUploadBaseUrl . $wgUploadPath  : $wgUploadPath, 'hashLevels' => $wgHashedUploadDirectory  ? 2 : 0, 'thumbScriptUrl' => $wgThumbnailScriptPath , 'transformVia404' => !$wgGenerateThumbnailOnParse , 'deletedDir' => $wgDeletedDirectory , 'deletedHashLevels' => $wgHashedUploadDirectory ? 3 : 0 ]; }

See also