Manual:$wgUseInstantCommons

From mediawiki.org
This page is a translated version of the page Manual:$wgUseInstantCommons and the translation is 56% complete.
Shared uploads: $wgUseInstantCommons
Activar InstantCommons , es decir, el uso de Wikimedia Commons como un almacén compartido.
Introducido en la versión:1.16.0 (r58652)
Eliminado en la versión:aún se usa
Valores permitidos:(boolean)
Valor predeterminado:false

Forma de uso

Agregue lo siguiente a su LocalSettings.php para habilitar InstantCommons:

$wgUseInstantCommons = true;

Detalles

Establecer este parámetro de configuración en true activa InstantCommons , que permite usar automáticamente en el wiki local imágenes alojadas en Wikimedia Commons.

La configuración de este parámetro de configuración es una abreviatura de la siguiente configuración en $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,
];

Nota

Activar esta característica no evita consumir espacio en disco en el servidor que corre el wiki local. Hasta MediaWiki 1.26, esta configuración generaba miniaturas en el disco local con fines de almacenamiento en caché. En caso de que se excedan las dimensiones del archivo original de Wikimedia Commons al incluir el archivo desde una página del wiki local, se guardará en el disco local una copia completa del archivo en su tamaño original.

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.

Véase también