WMDE Technical Wishes/Move files to Commons/Configuration file documentation

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

File checks and template matching with the FileImporter extension[edit]

In a nutshell[edit]

When you import a local file, the FileImporter checks its templates and then processes the file accordingly, e.g.

  • the import is prevented if the file has a license that's not suitable for Wikimedia Commons,
  • the import is prevented if the file is missing a template that clearly allows an import to Wikimedia Commons,
  • a template is replaced if an equivalent template exists on Wikimedia Commons.

All checks and their resulting actions are described in the table below.

The checks are based on configuration files. These files originate from the configuration files of the Commons2Helper tool.

Please note[edit]

  • Each wiki must have a configuration file. Imports from wikis without a configuration file will be blocked.
  • The configuration files are maintained by the individual wiki communities. If you want to use the FileExporter on your wiki, please check if your wiki's configuration file is set up correctly. The table below explains the function and structure of a configuration file.

In detail: How do the configuration files work?[edit]

Any changes that are made to these files come into effect immediately. E.g. if you add a template to the section “Templates:Transfer”, the next export will immediately include a check for this template.

What Where
it's defined in the config file
How it works Is it supported?
check license to allow or block imports Categories: Bad The FileImporter checks if the file contains any of the categories listed under “Bad”.
  • If it does, the transfer to Commons is blocked.
  • If the list is empty, the transfer isn’t blocked for any file.
  • If the section Categories: Bad doesn’t exist in the config file, all imports are blocked to prevent import mistakes.
Green tickY yes
Templates: Good The FileImporter checks if the file contains any of the templates listed under “Good”.
  • If not, the transfer to Commons is prevented.
  • If the file has a template which includes a template from this list, the transfer to Commons is allowed.
  • If the list is empty, the transfer is allowed for any file.
  • If the section Templates:Good doesn’t exist in the config file, all imports are blocked to prevent import mistakes.
Green tickY yes
Templates: Bad The FileImporter checks if the file contains any of the templates listed under “Bad”.
  • If it does, the transfer to Commons is blocked.
  • If the file has a template which includes a template from this list, the transfer to Commons is blocked.
  • If the list is empty, the transfer isn’t blocked for any file.
  • If the section Templates: Bad doesn’t exist in the config file, all imports are blocked to prevent import mistakes.
Green tickY yes
remove templates Templates: Remove The FileImporter checks if the file contains any of the templates listed under “Remove”, e.g. {{Move to Commons}}.
  • If it does, the templates are removed during transfer.
Green tickY yes
replace templates and parameters Templates: Transfer The FileImporter replaces the file’s local templates and parameters with the corresponding Commons templates and parameters from the list.

How to write the transfer rules in the config file:

replacing … transfer rule wikitext example
a template ; LOCAL_TEMPLATE: COMMONS_TEMPLATE ; Bild-CC-by-sa/4.0: Cc-by-sa-4.0
a template and its parameters ; LOCAL_TEMPLATE: COMMONS_TEMPLATE | COMMONS_PARAMETER=LOCAL_PARAMETER | … ; Information: Information |Description=Beschreibung | …
If the source template uses unnamed parameters, you must specify the corresponding number on the right side of the “=”. ; OTRS: PermissionOTRS | id=2

Red XN Current issues: The FileImporter transforms parameter names, but doesn’t put parameter values in language templates (e.g. {{de|deutsche Beschreibung}}).

Green tickY yes
(apart from language templates: T198607)
replace section headings Information: Description Replaces the heading of the description section according to the configuration file, e. g from Beschreibung in German Wikipedia to {{int:filedesc}} on Commons. If the heading of the local file isn’t in the configuration file, no replacements will be made. Green tickY yes
Information: Licensing Replaces the heading of the licensing section according to the configuration file, e. g from اجازه‌نامه in Farsi Wikipedia to {{int:license-header}} on Commons. If the heading of the local file isn’t in the configuration file, no replacements will be made. Green tickY yes

Not included[edit]

What Where
it would be defined in the config file
Description Is it supported?
add {{information}} template Information: Template If the file page on the local wiki doesn't contain a template, no {{Information|…}} template is created on Commons. Red XN not planned
replace or remove categories / In this version, categories are not matched, as this is a very complex thing to do. For now, categories must be replaced manually. Red XN not planned