Add forward compat hack for getBlockInfo/getBlockAsResultStructure

This is necessary to allow the unmitigated removal of
ApiQueryUserInfo::getBlockInfo to be fixed. See discussion on
I84ed21641c44b2f65.

Change-Id: I9f40666a31bd4af50762c197c2ce5bf089a5e68c
This commit is contained in:
daniel 2019-05-09 12:10:48 +02:00
parent 28c4e25024
commit a15875e247

View file

@ -508,7 +508,18 @@ class ApiVisualEditor extends ApiBase {
$block->getPermissionsError( $this->getContext() )
)->parseAsBlock(),
];
$blockinfo = $this->getBlockInfo( $block );
// HACK: Forward compatibility with changed method name.
// Remove this when no longer needed. The old method name was used
// only for a few days/weeks during development of MW 1.34.
// See discussion on <https://gerrit.wikimedia.org/r/c/mediawiki/core/+/506945>.
if ( method_exists( $this, 'getBlockInfo' ) ) {
// old name
$blockinfo = $this->getBlockInfo( $block );
} else {
// new name
$blockinfo = $this->getBlockDetails( $block );
}
}
// HACK: Build a fake EditPage so we can get checkboxes from it