메뉴얼:$wgUseInstantCommons

From mediawiki.org
This page is a translated version of the page Manual:$wgUseInstantCommons and the translation is 44% complete.
Shared uploads: $wgUseInstantCommons
InstantCommons 을 활성화합니다. 다시 말해서 위키미디어 공용을 공유 저장소로 활용합니다.
이 변수가 소개된 버전:1.16.0 (r58652)
이 변수가 사라진 버전:계속해서 쓰이고 있음
허용값:(불린)
기본값:false

사용법

LocalSettings.php 에 다음과 같은 내용을 추가하면 인스턴트 커먼즈가 활성화 됩니다.

$wgUseInstantCommons = true;

상세

이 설정 파라메터를 true로 설명하면 InstantCommons 가 활성화되며, 위키미디어 커먼즈에 호스팅된 이미지를 자동으로 로컬 위키 이미지로 사용되는 것을 허용합니다.

이 설정은 다음과 같은 $wgForeignFileRepos 설정의 축약형입니다.

$wgForeignFileRepos[] = [
	'class' => ForeignAPIRepo::class,
	'name' => 'wikimediacommons',
	'apibase' => 'https://commons.wikimedia.org/w/api.php',
	'url' => 'https://upload.wikimedia.org/wikipedia/commons',
	'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb',
	'hashLevels' => 2,
	'transformVia404' => true,
	'fetchDescription' => true,
	'descriptionCacheExpiry' => 43200,
	'apiThumbCacheExpiry' => 0,
];

참고

이 설정을 활성화라더라도 로컬 위키가 작동하고 있는 서버의 디스크 공간을 사용하는 것을 피할 수는 없습니다. Until MediaWiki 1.26, this setting did indeed generate thumbs on the local disk for caching purposes. In case the dimensions of the original file on Wikimedia Commons are exceeded when embedding the file on a page in the local wiki, the file will in its original size be put onto the local disk.

Since MediaWiki 1.27 (gerrit:251556), $wgUseInstantCommons hotlinks images from Commons by default instead of downloading originals and thumbnailing them locally.

This allows wikis to save on CPU and bandwidth while reducing time to first byte for pages, even without a thumbnail handler. This can make your wiki seem much faster

For example, if you have 100 InstantCommons images on a page, your wiki will make 400 API requests to the Commons API at page load time and the first byte of the page won't be returned for about 30 seconds. This can be somewhat improved by disabling $wgResponsiveImages You may prefer to override the default descriptionCacheExpiry by creating your own $wgForeignFileRepos entry, or maybe not use foreign file repositories at all and instead copy images from Commons to your own wiki using importImages.php . Note that counterintuitively, apiThumbCacheExpiry is fastest if set to 0. Another aspect that has a major affect on performance is how long metadata is cached. Unfortunately this is currently not configurable and hard coded to 3600 seconds (1 hour) which is rather short [1]

See the documentation of configuration parameter $wgForeignFileRepos for tweaks.

같이 보기