{"id":16102649,"url":"https://github.com/markus-rost/interwikidispatcher","last_synced_at":"2025-03-18T08:30:54.382Z","repository":{"id":177078300,"uuid":"657650159","full_name":"Markus-Rost/InterwikiDispatcher","owner":"Markus-Rost","description":"MediaWiki extension for adding some simple multi-level interwikis for easier linking to wiki farms.","archived":false,"fork":false,"pushed_at":"2024-09-10T12:54:17.000Z","size":42,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-10T18:54:22.381Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.mediawiki.org/wiki/Extension:InterwikiDispatcher","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Markus-Rost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-23T14:21:23.000Z","updated_at":"2024-09-10T12:53:58.000Z","dependencies_parsed_at":"2023-07-24T01:01:13.954Z","dependency_job_id":null,"html_url":"https://github.com/Markus-Rost/InterwikiDispatcher","commit_stats":null,"previous_names":["markus-rost/interwikidispatcher"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Markus-Rost%2FInterwikiDispatcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Markus-Rost%2FInterwikiDispatcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Markus-Rost%2FInterwikiDispatcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Markus-Rost%2FInterwikiDispatcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Markus-Rost","download_url":"https://codeload.github.com/Markus-Rost/InterwikiDispatcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221708930,"owners_count":16867651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T18:54:20.011Z","updated_at":"2025-03-18T08:30:54.370Z","avatar_url":"https://github.com/Markus-Rost.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InterwikiDispatcher extension\n\nThis is free software licensed under the GNU General Public License. Please\nsee http://www.gnu.org/copyleft/gpl.html for further details, including the\nfull text and terms of the license.\n\n## Overview\nThe **InterwikiDispatcher** extension adds some simple multi-level interwikis for easier linking to wiki farms.\n\nHooking into existing interwiki prefixes to provide some limited API support. Subdomain part of the interwiki is validated as `a-z\\d-` to avoid open redirect vulnerabilities. Scary transclusion will work when enabled for the interwiki prefix.\n\n## Installation\n* Download, extract, and place the files in a directory called `InterwikiDispatcher` in your `extensions/` folder.\n* Add the following code at the bottom of your [LocalSettings.php](https://www.mediawiki.org/wiki/Manual:LocalSettings.php) file: \n```php\nwfLoadExtension( 'InterwikiDispatcher' );\n```\n* Configure as required.\n* Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.\n\n## Configuration\n`$wgIWDPrefixes` is the sole variable controlling this extension's behaviour. The format is an array (keys do not matter) where values are associative arrays of parameters. These parameters are:\n* `'interwiki'` **(required)**: the interwiki prefix to apply this rule to.\n  * This prefix must be a valid and defined interwiki prefix.\n* `'subprefix'`: optional sub-prefix, which will be expected right after the interwiki prefix. For example a prefix of `'p'` and sub-prefix of `'s'` results in links of format `[[p:s:wiki:article]]` and `[[p:s:language.wiki:article]]`.\n* `'url'` **(required)**: external URL format. Placeholder `$1` stands for page title, `$2` for wiki domain.\n  * *Example:* `'https://$2.fandom.com/wiki/$1'`\n* `'urlInt'`: optional international external URL format. Placeholder `$3` stands for the language.\n  * *Example:* `'https://$2.fandom.com/$3/wiki/$1'`\n* `'baseTransOnly'`: if `true`, falls back to the base, classic interwiki during scary transclusion.\n  * *Default:* `false`\n* `'dbname'`: optional wiki ID format, used to check whether a wiki exists locally via [$wgLocalDatabases](https://www.mediawiki.org/wiki/Manual:$wgLocalDatabases). Placeholder `$2` is the wiki domain.\n  * *Example:* `'$2_en'`\n* `'dbnameInt'`: optional international wiki ID format, used to check whether a wiki exists locally via [$wgLocalDatabases](https://www.mediawiki.org/wiki/Manual:$wgLocalDatabases). Placeholder `$2` is the wiki domain, `$3` is the language.\n  * *Example:* `'$2_$3'`\n* `'wikiExistsCallback'`: optional custom function to check if a wiki exists. This completely replaces the DB check of `dbname`, `dbnameInt`.\n  * `function ( $rule, \u0026$wiki, \u0026$language ): bool`: Takes this array as `$rule`, domain as `\u0026$wiki`, language as `\u0026$language` (or empty string). Both `$wiki` and `$language` are out parameters: the callback may override them as needed.\n\n### Examples\n```php\n# [[w:c:minecraft]] =\u003e https://minecraft.fandom.com/wiki/\n# [[w:c:minecraft:Cookie]] =\u003e https://minecraft.fandom.com/wiki/Cookie\n# [[w:c:de.minecraft:Keks]] =\u003e https://minecraft.fandom.com/de/wiki/Keks\n$wgIWDPrefixes[] = [\n  'interwiki' =\u003e 'w', # Interwiki prefix that exists in the interwiki table\n  'subprefix' =\u003e 'c', # Optional: Subprefix to keep the base interwiki working mostly as expected\n  'url' =\u003e 'https://$2.fandom.com/wiki/$1', # URL format for the interwiki `w:c:$2:$1` ($1: page title, $2: domain)\n  'urlInt' =\u003e 'https://$2.fandom.com/$3/wiki/$1', # Optional: Additional URL format `w:c:$3.$2:$1` ($3: language).\n  'baseTransOnly' =\u003e true, # Optional: Fall back to the base interwiki for scary transclusion\n  'dbname' =\u003e '$2_en', # Optional: Wiki ID format to check existence via `$wgLocalDatabases`, subdomain as $2, language unspecified\n  'dbnameInt' =\u003e '$2_$3', # Optional: As above, but language provided as $3\n  'wikiExistsCallback' =\u003e null, # Optional: Custom function to check if the wiki exists, replaces the DB check.\n                                # Takes this array as `$rule`, domain as `\u0026$wiki`, language as `\u0026$language` (or empty string).\n];\n```\n```php\n# [[gg:terraria]] =\u003e https://terraria.wiki.gg/wiki/\n# [[gg:terraria:NPCs]] =\u003e https://terraria.wiki.gg/wiki/NPCs\n# [[gg:de.terraria:NPCs]] =\u003e https://terraria.wiki.gg/de/wiki/NPCs\n$wgIWDPrefixes[] = [\n  'interwiki' =\u003e 'gg',\n  'url' =\u003e 'https://$2.wiki.gg/wiki/$1',\n  'urlInt' =\u003e 'https://$2.wiki.gg/$3/wiki/$1',\n  'dbname' =\u003e '$2_en',\n  'dbnameInt' =\u003e '$2_$3',\n];\n```\n```php\n# [[mh:meta]] =\u003e https://meta.miraheze.org/wiki/\n# [[mh:meta:Miraheze]] =\u003e https://meta.miraheze.org/wiki/Miraheze\n$wgIWDPrefixes[] = [\n  'interwiki' =\u003e 'mh',\n  'url' =\u003e 'https://$2.miraheze.org/wiki/$1',\n];\n```\n```php\n$wgIWDPrefixes = [\n  # [[farm:mh:meta]] =\u003e https://meta.miraheze.org/wiki/\n  # [[farm:mh:meta:Miraheze]] =\u003e https://meta.miraheze.org/wiki/Miraheze\n  'miraheze' =\u003e [\n    'interwiki' =\u003e 'farm',\n    'subprefix' =\u003e 'mh',\n    'url' =\u003e 'https://$2.miraheze.org/wiki/$1',\n  ],\n  # [[farm:fd:minecraft]] =\u003e https://minecraft.fandom.com/wiki/\n  # [[farm:fd:minecraft:Cookie]] =\u003e https://minecraft.fandom.com/wiki/Cookie\n  # [[farm:fd:de.minecraft:Keks]] =\u003e https://minecraft.fandom.com/de/wiki/Keks\n  'fandom' =\u003e [\n    'interwiki' =\u003e 'farm',\n    'subprefix' =\u003e 'fd',\n    'url' =\u003e 'https://$2.fandom.com/wiki/$1',\n    'urlInt' =\u003e 'https://$2.fandom.com/$3/wiki/$1',\n  ],\n  # [[farm:gg:terraria]] =\u003e https://terraria.wiki.gg/wiki/\n  # [[farm:gg:terraria:NPCs]] =\u003e https://terraria.wiki.gg/wiki/NPCs\n  # [[farm:gg:de.terraria:NPCs]] =\u003e https://terraria.wiki.gg/de/wiki/NPCs\n  'wikigg' =\u003e [\n    'interwiki' =\u003e 'farm',\n    'subprefix' =\u003e 'gg',\n    'url' =\u003e 'https://$2.wiki.gg/wiki/$1',\n    'urlInt' =\u003e 'https://$2.wiki.gg/$3/wiki/$1',\n  ],\n];\n```\n\n## Special:Interwiki integration\nAn additional table for \"Multi-level interwiki prefixes\" will be added to Special:Interwiki listing the interwikis managed by this extension.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkus-rost%2Finterwikidispatcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkus-rost%2Finterwikidispatcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkus-rost%2Finterwikidispatcher/lists"}