Manual:$wgForeignFileRepos/ja

すべてのリポジトリに対して要求されるプロパティ

 * class
 * リポジトリに対するクラス名です. コアもしくはエクステンションから由来することがあります. コアリポジトリクラスはLocalRepo、ForeignDBRepo、FSRepoです.


 * name
 * リポジトリに対するユニークな名前.

すべてのコアリポジトリに対して

 * url
 * 基底の公開URL


 * thumbUrl
 * 基底のサムネイルURL (URLとサムネイルの場所が異なる場合).


 * hashLevels
 * ハッシュベースのファイルのディビジョンに対するディレクトリレベルの数


 * thumbScriptUrl
 * thumb.phpに対するURL (省略可能、推奨されません)


 * transformVia404
 * パーサ上のメディアファイルの変換をスキップして、代わりに404ハンドラに頼るかどうか.


 * initialCapital
 * $wgCapitalLinksと同等で、ファイル名を暗黙で大文字で始めるかどうか. 現在の実装はローカルの$wgCapitalLinksとinitialCapitalがミスマッチする場合、 正しくない説明ページのリンクをするかもしれません.


 * pathDisclosureProtection
 * エラーメッセージからすべてのパラメータを削除したい場合は'paranoid'、パスを変更しないままにするには'none'、プレースホルダでパスを置き換える場合は'simple'デフォルトのLocalRepoは'simple'です. Note, some image thumbnailing software puts the thumbnail path into the resulting thumb's metadata, so this setting may not provide full protection.


 * descBaseUrl
 * 画像の説明ページのURLです. 例:


 * scriptDirUrl
 * MediaWikiのインストール先のURLで、$wgScriptPathと同等です. 例:


 * articleUrl
 * $wgArticlePathと同等で、例:


 * fetchDescription
 * Fetch the text of the remote file description page. Equivalent to $wgFetchCommonsDescriptions.


 * descriptionCacheExpiry
 * If set to 0, no caching will be used. Set to 1 or more (seconds) to define how long the local cache of description pages will last. Must set fetchDescription to true to use.

ForeignAPIRepo class

 * apibase
 * The base URL for the remote repository's API (eg: ). Only used for ForeignAPIRepo.


 * apiThumbCacheExpiry
 * How long to cache thumbs locally for. Not setting this or setting to 0 disables local thumb caching

ForeignDBRepo class

 * dbType, dbServer, dbUser, dbPassword, dbName, dbFlags
 * equivalent to the corresponding member of $wgDBservers


 * tablePrefix
 * Table prefix, the foreign wiki's $wgDBprefix


 * hasSharedCache
 * True if the wiki's shared cache is accessible via the local $wgMemc


 * favicon
 * A favicon for the remote repository

Default value (code in Setup.php):

Directory permissions
You'll need rw on  and   for whatever user php runs as.

Using files from Wikimedia Commons : ForeignAPIRepo

 * Since 1.16.0 there is a more convenient shorthand to use Commons as a foreign repository: $wgUseInstantCommons.

You can set your wiki to use media from Wikimedia Commons (or from any other MediaWiki-powered site, see below) directly. However, please beware any legal implications.

To use this, you need:
 * MediaWiki 1.13 or later
 * PHP with JSON support (for the  function). JSON is enabled by default since PHP 5.2.0, you'll need the PECL extension for older versions. Since MediaWiki 1.16, this is no longer necessary; v. 1.16 will use custom (and slower) code if JSON is not available.
 * The remote wiki must also use MediaWiki 1.13 or later; otherwise its  returns   and file requests fail silently (i.e. the requested files are just treated as non-existent).

The code below enables media files from Wikimedia Commons on your site. You should place it in you "LocalSettings.php" file:

To pull images from another Wikimedia project, set apibase to this wiki's "api.php" file like e.g.  http://en.wikipedia.org/w/api.php . Example:

To embed an image in your installation, simply use  .

You may need to configure the $wgMainCacheType as well. Default it is set to CACHE_NONE, meaning it will load the image from the remote host on each page load. Similarly, you need to set apiThumbCacheExpiry to zero if you prefer to use the foreign thumbnails.

Using files from a database that you can access : ForeignDBRepo
The ForeignDBRepo class is very useful for creating wiki families. In a wiki family, each wiki will have its own database or table prefix. Using this class, you can make a family member aware of the tables of another family member. Access through ForeignDBRepo is faster than through ForeignAPIRepo. This code should be deployed to LocalSettings.php.

Alternatively, if you have $wgLBFactoryConf set up for multiple wikis, you can use 'class' => 'ForeignDBRepoViaLB' and 'wiki' => 'wiki db name used with load balancer' (and not need all the db* parameters in the above config).

Using files from a local folder : FSRepo
You can set your wiki to use media from a single folder. This is just a demonstration feature at present, and will probably be too slow for busy wikis or slow servers due to the lack of caching. This code should be deployed to LocalSettings.php.

The below code enabled media files from it: