Namespace extension

Change-Id: Ia510f65e739d21bcfd6072c82859109d05cf5dd1
This commit is contained in:
Reedy 2021-03-14 05:06:15 +00:00
parent 3c057c920e
commit 7bb8875696
4 changed files with 31 additions and 14 deletions

View file

@ -40,8 +40,8 @@
]
},
"Hooks": {
"InterwikiLoadPrefix": "InterwikiHooks::onInterwikiLoadPrefix",
"UserGetAllRights": "InterwikiHooks::onUserGetAllRights"
"InterwikiLoadPrefix": "MediaWiki\\Extension\\Interwiki\\Hooks::onInterwikiLoadPrefix",
"UserGetAllRights": "MediaWiki\\Extension\\Interwiki\\Hooks::onUserGetAllRights"
},
"ResourceModules": {
"ext.interwiki.specialpage": {
@ -53,18 +53,16 @@
"remoteExtPath": "Interwiki/modules"
},
"SpecialPages": {
"Interwiki": "SpecialInterwiki"
"Interwiki": "MediaWiki\\Extension\\Interwiki\\SpecialInterwiki"
},
"ExtensionFunctions": [
"InterwikiHooks::onExtensionFunctions"
"MediaWiki\\Extension\\Interwiki\\Hooks::onExtensionFunctions"
],
"AutoloadClasses": {
"InterwikiHooks": "includes/InterwikiHooks.php",
"SpecialInterwiki": "includes/SpecialInterwiki.php",
"InterwikiLogFormatter": "includes/InterwikiLogFormatter.php"
"AutoloadNamespaces": {
"MediaWiki\\Extension\\Interwiki\\": "includes/"
},
"LogActionsHandlers": {
"interwiki/*": "InterwikiLogFormatter"
"interwiki/*": "MediaWiki\\Extension\\Interwiki\\InterwikiLogFormatter"
},
"manifest_version": 2
}

View file

@ -1,8 +1,12 @@
<?php
namespace MediaWiki\Extension\Interwiki;
use Hooks as MWHooks;
use Language;
use MediaWiki\MediaWikiServices;
class InterwikiHooks {
class Hooks {
/** @var bool */
private static $shouldSkipIWCheck = false;
/** @var bool */
@ -37,8 +41,8 @@ class InterwikiHooks {
return;
}
// This will trigger a deprecation warning in MW 1.36+
Hooks::register(
'InterwikiLoadPrefix', 'InterwikiHooks::onInterwikiLoadPrefix'
MWHooks::register(
'InterwikiLoadPrefix', [ self::class, 'onInterwikiLoadPrefix' ]
);
}

View file

@ -1,5 +1,10 @@
<?php
namespace MediaWiki\Extension\Interwiki;
use LogFormatter;
use Message;
/**
* Needed to pass the URL as a raw parameter, because it contains $1
*/

View file

@ -1,6 +1,17 @@
<?php
namespace MediaWiki\Extension\Interwiki;
use Html;
use HTMLForm;
use Language;
use LogPage;
use MediaWiki\MediaWikiServices;
use OutputPage;
use PermissionsError;
use ReadOnlyError;
use SpecialPage;
use Status;
/**
* Implements Special:Interwiki
@ -481,8 +492,7 @@ class SpecialInterwiki extends SpecialPage {
protected function makeTable( $canModify, $iwPrefixes ) {
// Output the existing Interwiki prefixes table header
$out = '';
$out .= Html::openElement(
$out = Html::openElement(
'table',
[ 'class' => 'mw-interwikitable wikitable sortable body' ]
) . "\n";