InstantCommons

From mediawiki.org
This page is a translated version of the page InstantCommons and the translation is 43% complete.
Outdated translations are marked like this.
Geben Sie den Namen eines Bilds aus Commons in irgendeiner MediaWiki-Installation ein ...
... und das Bild wird von Commons abgerufen und in die Seite eingebunden

InstantCommons ist ein Feature von MediaWiki, das die Nutzung von beliebigen Medien aus Wikimedia Commons in jeder beliebigen MediaWiki-Installation weltweit ermöglicht.

Gründe

Im November 2023 enthielt das zentrale Medienarchiv Wikimedia Commons, das von der Wikimedia Foundation gehostet wird, über 73 Millionen Dateien. Alle diese Dateien sind unter einer freien Lizenz verfügbar oder in der Public Domain und es gibt neben den Beschränkungen zur Nutzung offizieller Hoheitszeichen oder Marken keine weiteren Beschränkungen. Lizenzen, die die kommerzielle Nutzung einschränken, werden als unfrei betrachtet. Each of these files is available under a free content license or in the public domain; there are no other restrictions of use beyond those relating to use of official insignia or trademarks. Licenses which limit commercial use are considered non-free.

Mit wachsendem Bewusstsein für die Existenz von Commons wächst auch der Wunsch externer Parteien, Inhalte von dort zu nutzen und neues Material beizutragen. Es ist im Moment technisch möglich, Bilder direkt von den Wikimedia-Servern auf beliebigen Seiten zu laden. Dieses "Hotlinking" ist erlaubt, aber aus mehreren Gründen problematisch: It is currently technically possible to load images directly from Wikimedia's servers in the context of any webpage. Such hotlinking is allowed, but it is problematic for multiple reasons:

  • Es respektiert die Lizenzbedingungen des Bildes nicht und gewährleistet nicht, dass andere Metadaten verlässlich transportiert werden
  • Besides failing to properly credit the author of the media file, it also does not give credit to Wikimedia
  • Es nutzt bei jedem Seitenaufruf Bandbreite von Wikimedia (es sei denn, wenn das Bild clientseitig oder von einem Proxy gecacht wurde; diese Funktion ist derzeit standardmäßig deaktiviert)
  • Es macht nützliche Bildoperationen, wie das Erstellen von Vorschaubildern oder das Einfügen von Bildunterschriften nicht leichter und ist innerhalb eines Wikis schwierig zu nutzen, insbesondere bei Standard-Layouts
  • Es ist an URLs zum Identifizieren einer Ressource gebunden, was Mirroring komplizierter macht
  • It creates an untrackable external usage web, where any change on Wikimedia's side necessarily affects these external users
  • Es erlaubt keine Offline-Betrachtung, was in Ländern mit eingeschränktem Netzzugang problematisch ist.

InstantCommons versucht, all diese Probleme zu adressieren, indem es eine einfache Methode zum gecachten Laden von Bildern und Metadaten von Wikimedia-Servern zur Verfügung stellt. Although caching functionality is part of the objective, it has been disabled since MediaWiki 1.27.2/1.28.1. InstantCommons was first implemented within MediaWiki, allowing for all MediaWiki image operations (thumbnailing, captioning, galleries, etc.) to be performed transparently. Nichtsdestotrotz können auch andere Wiki-Engines InstantCommons-ähnliche Funktionen implementieren, indem sie die unten beschriebenen API-Operationen nutzen.

Grundlegende Funktionen

Während der Installation kann der Seiten-Administrator auswählen, ob InstantCommons aktiviert werden soll. Idealerweise sollte das Feature allerdings standardmäßig aktiviert sein (gesetzt dem Fall, dass ein beschreibbares Upload-Verzeichnis angegeben ist), um es der größtmöglichen Anzahl Nutzer zu ermöglichen, Inhalte von Wikimedia Commons zu nutzen.

If the feature is enabled, the wiki behaves like a Wikimedia project, that is, if an image or other media file is referred to which exists on Commons, it can be included in a wiki page like a locally uploaded file by specifying its name. Local filenames take precedence over Commons filenames.

Konfiguration

Default method: $wgUseInstantCommons

Um InstantCommons in MediaWiki Version 1.16 oder höher zu aktivieren, reicht es aus, diese Zeile zu LocalSettings.php hinzuzufügen (siehe $wgUseInstantCommons für Details):

$wgUseInstantCommons = true;

Zur Aktivierung in den MediaWiki-Versionen 1.13-1.15 finden Sie Manual:$wgForeignFileRepos#Using files from Wikimedia Commons : ForeignAPIRepo Informationen.

This feature should work immediately. If it's not, check if the PHP function curl_exec() is disabled in your web server. A HTTP Proxy is configured for cURL with $wgHTTPProxy .

Classic InstantCommons with local thumb caching

Default InstantCommons as enabled through $wgUseInstantCommons uses thumb images hotlinked from Wikimedia.[1] This may be slow and may also interfere with file caching (broken links). If you would like to generate and use thumbs on your local server, do not use $wgUseInstantCommons. Instead, insert this code into LocalSettings.php as described here: Manual:$wgForeignFileRepos#Usage.

$wgForeignFileRepos[] = [
	'class' => ForeignAPIRepo::class,
	'name' => 'commonswiki', // Must be a distinct name
	'apibase' => 'https://commons.wikimedia.org/w/api.php',
	'hashLevels' => 2,
	'fetchDescription' => true, // Optional
	'descriptionCacheExpiry' => 43200, // 12 hours, optional (values are seconds)
	'apiThumbCacheExpiry' => 86400, // 24 hours, optional, but required for local thumb caching
];

HTTPS

Starting June 2015, Wikimedia Commons can only be accessed using HTTPS. Some installs may be missing their root certificate store which prevents MediaWiki from contacting Commons over HTTPS. If InstantCommons stopped working, try:

  • Installing the php curl extension. (It is generally more reliable, and more likely to have proper certificates already installed.) On Debian/Ubuntu: sudo apt-get install php-curl

SElinux

If your server OS implements SElinux, please take a look at the dedicated section on the SELinux settings page, and make sure HTTPD scripts and modules can access the network successfully. If SElinux prevents HTTPD scripts and modules from connecting to WikiMedia Commons repository, the InstantCommons feature will simply not work.

Hinter einer Firewall

If the server on which the wiki runs is behind a firewall, the wiki server must be granted outgoing http/https requests to commons.wikimedia.org and upload.wikimedia.org, for Instant Commons to work. The IP address ranges are found at wikitech:IP addresses.

Dateien über InstantCommons nutzen

With InstantCommons enabled, you can choose any image from Wikimedia Commons (e.g. this one), click the "Use this file" button (the button with the wiki icon next to) and paste the markup in your wiki. In unserem Beispiel wird das Einfügen von

[[File:Wikipedia-Marker-commons.svg|thumb|Ein Bild von Wikimedia Commons, das in dieses Wiki eingebettet ist]]
Ein Bild von Wikimedia Commons, das in dieses Wiki eingebettet ist

dieses Vorschaubild erzeugen (siehe rechts).

Bitte beachten Sie, dass Sie, wenn Sie Dateien auf diese Weise nutzen, immer noch die Lizenzbestimmungen und alle anderen rechtlichen Anforderungen für die Nutzung der Datei beachten müssen - siehe dazu: Commons:Reusing content outside Wikimedia.

Überlegungen zur Skalierbarkeit

Because the InstantCommons feature allows a wiki user to download resources from the Wikimedia servers, it is crucial that there is no possibility of a Denial of Service attack against either the using wiki, or the Wikimedia Commons, for example, by pasting 30K of links to the largest files on Wikimedia Commons into a wiki page and pressing "preview". Therefore, every successful InstantCommons request will have to be logged by the InstantCommons-enabled wiki together with the originating user or IP address and the time of the request. If an individual user overrides a generous internal bandwidth limitation (could be as high as 1 GB by default, but should be user-configurable), future images will not be downloaded within a 24 hour period. This limitation should not exist for wiki administrators (if a wiki admin wants to conduct a denial of service attack against their own wiki, they do not need to be stopped from doing so; if they want to conduct an attack against Wikimedia, they cannot be stopped from doing so except on Wikimedia's end). In addition to the per-user bandwidth limit, there could be a limit on the size of files which should be downloaded transparently. This would primarily be because files above a certain size would delay pageviews significantly and might even cause the page request to time out. It might be desirable to use an external application for the purpose of downloading these files, so that it can be done in the background without causing the page request to continue. Finally, there could be a total maximum size for the InstantCommons cache; if this size is exceeded, no further files would be downloaded.

While it is unlikely that individual wikis using the InstantCommons feature would cause a significant increase in cost for the Wikimedia Foundation (since every file only has to be downloaded once, and there are per-user bandwidth limitations), it would nevertheless be fair and reasonable for projects using the feature to include a notice on InstantCommons description pages such as: "This file comes from Wikimedia Commons, a media archive hosted by the Wikimedia Foundation. If you would like to support the Wikimedia Foundation, you can donate here ..."

Zukunftspotential

In the future, it may be desirable to offer a publisher/subscribe model of changes, which will require wiki-to-wiki authentication and a database of images which are used in subscribing wikis. This would also open up the threat of cross-wiki vandalism, which could be addressed using a delay phase of 24 hours or more for changes to take effect. Two-way functionality is another possibility, that is, to allow uploading free media directly to Commons from any wiki installation. However, this will require federated authentication as a minimum. It may also necessitate cross-wiki communication facilities to notify users from other wikis about Commons policies, which could be part of a larger project like Erweiterung:LiquidThreads .

Siehe auch

References