Deprecate DummyLinker
DummyLinker existed for backwards-compatibility with a few hooks that have since been removed, e.g. 'LinkBegin'. The last hook using it is 'ImageBeforeProduceHTML', and it looks like it can be harmlessly replaced there with `null` (none of the extensions implementing the hook use this parameter). Let's try deprecating it. Change-Id: I73549afdafd681fc238e825f03bff329a65a3f47
This commit is contained in:
parent
22e2e01377
commit
a7562f9355
4 changed files with 202 additions and 2 deletions
|
|
@ -533,6 +533,8 @@ because of Phabricator reports.
|
|||
Language::getBlockDurations() instead.
|
||||
* MediaWikiServices::getBlockErrorFormatter() has been deprecated, use
|
||||
MediaWikiServices::getFormatterFactory()->getBlockErrorFormatter() instead.
|
||||
* DummyLinker has been deprecated. The DummyLinker parameter to the
|
||||
'ImageBeforeProduceHTML' hook will become null in the future.
|
||||
* Database::listViews() has been deprecated. This was previously used to filter
|
||||
views out of the return value of Database::listTables(). Now listTables()
|
||||
will not include views. MediaWiki does not use views.
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ interface ImageBeforeProduceHTMLHook {
|
|||
*
|
||||
* @since 1.35
|
||||
*
|
||||
* @param DummyLinker $linker Formerly a Skin/Linker, now a DummyLinker for b/c
|
||||
* @param DummyLinker $linker Deprecated, do not use.
|
||||
* @param Title &$title Title object of the image
|
||||
* @param File|false &$file File object, or false if it doesn't exist
|
||||
* @param array &$frameParams Various parameters with special meanings; see documentation in
|
||||
|
|
|
|||
|
|
@ -11,9 +11,21 @@ use Parser;
|
|||
|
||||
/**
|
||||
* @since 1.18
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
class DummyLinker {
|
||||
|
||||
public function __construct() {
|
||||
// Avoid deprecation warning when calling the 'ImageBeforeProduceHTML' hook.
|
||||
// Warnings will be emitted instead if any method is accessed by a hook handler.
|
||||
if ( wfGetCaller() !== Linker::class . '::makeImageLink' ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function link(
|
||||
$target,
|
||||
$html = null,
|
||||
|
|
@ -21,6 +33,7 @@ class DummyLinker {
|
|||
$query = [],
|
||||
$options = []
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::link(
|
||||
$target,
|
||||
$html,
|
||||
|
|
@ -30,6 +43,9 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function linkKnown(
|
||||
$target,
|
||||
$html = null,
|
||||
|
|
@ -37,6 +53,7 @@ class DummyLinker {
|
|||
$query = [],
|
||||
$options = [ 'known' ]
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::linkKnown(
|
||||
$target,
|
||||
$html,
|
||||
|
|
@ -46,6 +63,9 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function makeSelfLinkObj(
|
||||
$nt,
|
||||
$html = '',
|
||||
|
|
@ -53,6 +73,7 @@ class DummyLinker {
|
|||
$trail = '',
|
||||
$prefix = ''
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::makeSelfLinkObj(
|
||||
$nt,
|
||||
$html,
|
||||
|
|
@ -62,11 +83,15 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function getInvalidTitleDescription(
|
||||
IContextSource $context,
|
||||
$namespace,
|
||||
$title
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::getInvalidTitleDescription(
|
||||
$context,
|
||||
$namespace,
|
||||
|
|
@ -74,10 +99,17 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function makeExternalImage( $url, $alt = '' ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::makeExternalImage( $url, $alt );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function makeImageLink(
|
||||
Parser $parser,
|
||||
Title $title,
|
||||
|
|
@ -88,6 +120,7 @@ class DummyLinker {
|
|||
$query = "",
|
||||
$widthOption = null
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::makeImageLink(
|
||||
$parser,
|
||||
$title,
|
||||
|
|
@ -100,6 +133,9 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function makeThumbLinkObj(
|
||||
Title $title,
|
||||
$file,
|
||||
|
|
@ -110,6 +146,7 @@ class DummyLinker {
|
|||
$framed = false,
|
||||
$manualthumb = ""
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::makeThumbLinkObj(
|
||||
$title,
|
||||
$file,
|
||||
|
|
@ -122,6 +159,9 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function makeThumbLink2(
|
||||
Title $title,
|
||||
$file,
|
||||
|
|
@ -130,6 +170,7 @@ class DummyLinker {
|
|||
$time = false,
|
||||
$query = ""
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::makeThumbLink2(
|
||||
$title,
|
||||
$file,
|
||||
|
|
@ -140,7 +181,11 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function processResponsiveImages( $file, $thumb, $hp ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
Linker::processResponsiveImages(
|
||||
$file,
|
||||
$thumb,
|
||||
|
|
@ -148,6 +193,9 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function makeBrokenImageLinkObj(
|
||||
$title,
|
||||
$label = '',
|
||||
|
|
@ -156,6 +204,7 @@ class DummyLinker {
|
|||
$unused2 = '',
|
||||
$time = false
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::makeBrokenImageLinkObj(
|
||||
$title,
|
||||
$label,
|
||||
|
|
@ -166,7 +215,11 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function makeMediaLinkObj( $title, $html = '', $time = false ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::makeMediaLinkObj(
|
||||
$title,
|
||||
$html,
|
||||
|
|
@ -174,7 +227,11 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function makeMediaLinkFile( Title $title, $file, $html = '' ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::makeMediaLinkFile(
|
||||
$title,
|
||||
$file,
|
||||
|
|
@ -182,10 +239,17 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function specialLink( $name, $key = '' ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::specialLink( $name, $key );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function makeExternalLink(
|
||||
$url,
|
||||
$text,
|
||||
|
|
@ -194,6 +258,7 @@ class DummyLinker {
|
|||
$attribs = [],
|
||||
$title = null
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::makeExternalLink(
|
||||
$url,
|
||||
$text,
|
||||
|
|
@ -204,7 +269,11 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function userLink( $userId, $userName, $altUserName = false, $attributes = [] ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::userLink(
|
||||
$userId,
|
||||
$userName,
|
||||
|
|
@ -213,6 +282,9 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function userToolLinks(
|
||||
$userId,
|
||||
$userText,
|
||||
|
|
@ -220,6 +292,7 @@ class DummyLinker {
|
|||
$flags = 0,
|
||||
$edits = null
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::userToolLinks(
|
||||
$userId,
|
||||
$userText,
|
||||
|
|
@ -229,7 +302,11 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function userToolLinksRedContribs( $userId, $userText, $edits = null ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::userToolLinksRedContribs(
|
||||
$userId,
|
||||
$userText,
|
||||
|
|
@ -237,32 +314,56 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function userTalkLink( $userId, $userText ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::userTalkLink( $userId, $userText );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function blockLink( $userId, $userText ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::blockLink( $userId, $userText );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function emailLink( $userId, $userText ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::emailLink( $userId, $userText );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function revUserLink( RevisionRecord $revRecord, $isPublic = false ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::revUserLink( $revRecord, $isPublic );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function revUserTools( RevisionRecord $revRecord, $isPublic = false ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::revUserTools( $revRecord, $isPublic );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function formatComment(
|
||||
$comment,
|
||||
$title = null,
|
||||
$local = false,
|
||||
$wikiId = null
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::formatComment(
|
||||
$comment,
|
||||
$title,
|
||||
|
|
@ -271,12 +372,16 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function formatLinksInComment(
|
||||
$comment,
|
||||
$title = null,
|
||||
$local = false,
|
||||
$wikiId = null
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::formatLinksInComment(
|
||||
$comment,
|
||||
$title,
|
||||
|
|
@ -285,7 +390,11 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function normalizeSubpageLink( $contextTitle, $target, &$text ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::normalizeSubpageLink(
|
||||
$contextTitle,
|
||||
$target,
|
||||
|
|
@ -293,12 +402,16 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function commentBlock(
|
||||
$comment,
|
||||
$title = null,
|
||||
$local = false,
|
||||
$wikiId = null
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::commentBlock(
|
||||
$comment,
|
||||
$title,
|
||||
|
|
@ -307,23 +420,43 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function revComment( RevisionRecord $revRecord, $local = false, $isPublic = false ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::revComment( $revRecord, $local, $isPublic );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function formatRevisionSize( $size ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::formatRevisionSize( $size );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function tocIndent() {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::tocIndent();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function tocUnindent( $level ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::tocUnindent( $level );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex = false ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::tocLine(
|
||||
$anchor,
|
||||
$tocline,
|
||||
|
|
@ -333,18 +466,33 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function tocLineEnd() {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::tocLineEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function tocList( $toc, Language $lang = null ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::tocList( $toc, $lang );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function generateTOC( $tree, Language $lang = null ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::generateTOC( $tree, $lang );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function makeHeadline(
|
||||
$level,
|
||||
$attribs,
|
||||
|
|
@ -353,6 +501,7 @@ class DummyLinker {
|
|||
$link,
|
||||
$legacyAnchor = false
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::makeHeadline(
|
||||
$level,
|
||||
$attribs,
|
||||
|
|
@ -363,15 +512,23 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function splitTrail( $trail ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::splitTrail( $trail );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function generateRollback(
|
||||
RevisionRecord $revRecord,
|
||||
IContextSource $context = null,
|
||||
$options = []
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::generateRollback(
|
||||
$revRecord,
|
||||
$context,
|
||||
|
|
@ -379,15 +536,23 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function getRollbackEditCount( RevisionRecord $revRecord, $verify ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::getRollbackEditCount( $revRecord, $verify );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function buildRollbackLink(
|
||||
RevisionRecord $revRecord,
|
||||
IContextSource $context = null,
|
||||
$editCount = false
|
||||
) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::buildRollbackLink(
|
||||
$revRecord,
|
||||
$context,
|
||||
|
|
@ -395,11 +560,19 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function formatHiddenCategories( $hiddencats ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::formatHiddenCategories( $hiddencats );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function titleAttrib( $name, $options = null, array $msgParams = [] ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::titleAttrib(
|
||||
$name,
|
||||
$options,
|
||||
|
|
@ -407,11 +580,19 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function accesskey( $name ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::accesskey( $name );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function getRevDeleteLink( User $user, RevisionRecord $revRecord, Title $title ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::getRevDeleteLink(
|
||||
$user,
|
||||
$revRecord,
|
||||
|
|
@ -419,7 +600,11 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function revDeleteLink( $query = [], $restricted = false, $delete = true ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::revDeleteLink(
|
||||
$query,
|
||||
$restricted,
|
||||
|
|
@ -427,18 +612,30 @@ class DummyLinker {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function revDeleteLinkDisabled( $delete = true ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::revDeleteLinkDisabled( $delete );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function tooltipAndAccesskeyAttribs( $name, array $msgParams = [] ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::tooltipAndAccesskeyAttribs(
|
||||
$name,
|
||||
$msgParams
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.42
|
||||
*/
|
||||
public function tooltip( $name, $options = null ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
return Linker::tooltip( $name, $options );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -333,7 +333,8 @@ class Linker {
|
|||
) {
|
||||
$title = Title::newFromLinkTarget( $title );
|
||||
$res = null;
|
||||
$dummy = new DummyLinker;
|
||||
// DummyLinker is deprecated since 1.42, $dummy will be replaced with null.
|
||||
$dummy = new DummyLinker();
|
||||
$hookRunner = new HookRunner( MediaWikiServices::getInstance()->getHookContainer() );
|
||||
if ( !$hookRunner->onImageBeforeProduceHTML( $dummy, $title,
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgument Type mismatch on pass-by-ref args
|
||||
|
|
|
|||
Loading…
Reference in a new issue