Manual talk:Interwiki cache
Add topicadding new global sites to interwiki cache
[edit]I have been using the Interwiki extension for a while now (since MediaWiki 1.34 at least), quite successfully, on my own multi-language wiki. I was able to add further external wiki sites using the Special:Interwiki page, for example a few fandom wikis that were quoted in various articles.
However, after recently upgrading from 1.39 to 1.41, I started seeing the following warning:
PHP Deprecated: Use of InterwikiLoadPrefix hook (used in MediaWiki\Extension\Interwiki\Hooks::onInterwikiLoadPrefix) was deprecated in MediaWiki 1.36. [Called from MediaWiki\HookContainer\HookContainer::register in /var/www/vhosts/mywiki_1_41/w/includes/HookContainer/HookContainer.php at line 438] in /var/www/vhosts/mywiki_1_41/w/includes/debug/MWDebug.php on line 386
I read the following pages:
which led me to install the WikimediaMaintenance extension.
Running the dumpInterwiki.php
script was still not very straightforward, so I then stumbled upon the current page, and I followed the instructions under Interwiki cache#Setting this up on your own wiki.
Instead of changing the path /srv/mediawiki
for the three files all.dblist, special.dblist, and langlist, I simply made sure they were placed correctly: langlist in the root of the mediawiki instance, and all.dblist and special.dblist in a dblists/
folder. Then I could run export MEDIAWIKI_DEPLOYMENT_DIR=$PWD && ./maintenance/run ./extensions/WikimediaMaintenance/dumpInterwiki.php --wiki en > cache/interwiki.php
from the root directory of the mediawiki instance.
Now that I've given context, here's for the actual question, regarding the fandom wikis: on the Special:Interwiki page, I have defined for example a prefix for the Dark Fandom site:
Prefix | URL | Forward | Transclude |
---|---|---|---|
dark | https://dark-netflix.fandom.com/wiki/$1 | no | - |
In my LocalSettings.php
I define the central database for interwiki links, using the database for my english wiki:
$wgInterwikiCentralDB = 'mywiki_en';
However, adding the prefix dark to all.dblist and/or special.dblist does not result in a global definition such as this:
'__global:dark' => '0 https://dark-netflix.fandom.com/wiki/$1',
It needs to be defined as __global
in order to work, however it seems that the dumpInterwiki.php
maintenance script is not using the interwiki table at all, so it has no idea how to map the prefix dark
to the URL https://dark-netflix.fandom.com/wiki/$1
.
In the end I just simply manually edited the resulting interwiki.php
adding all the necessary __global
definitions for all the extra external wikis I would like to have prefixes for, and which aren't already included from the .dblist files. This of course meant also including the same prefixes in '__list:__global' => '...'
.
Also, in order for interwiki links between languages on my wiki to work again, I had to manually edit all of the '_wiki:nn' => '...'
links to point to my own wiki rather than to wikipedia. Otherwise the "also in this language" dropdown would try to send you to the language version of wikipedia (where the wiki article doesn't exist), instead of to the language version of my own wiki (where the wiki article exists).
In the end, I really don't see why using the database table is no longer considered a feasible approach, generating a warning if $wgInterwikiCache
is not defined. Shouldn't that simply be an option from wiki to wiki? Defining $wgInterwikiCache
could be very well suggested and recommended, but I don't think it needs to be enforced or should generate a warning if not utilized. At least until there's a cleaner approach to generating the PHP cache file, for example using the data already defined in the database.