Merge "Emergency: discussiontoolspageinfo return empty response in non-talk ns"

This commit is contained in:
jenkins-bot 2022-12-19 08:55:49 +00:00 committed by Gerrit Code Review
commit 0a5397b4b5

View file

@ -42,6 +42,21 @@ class ApiDiscussionToolsPageInfo extends ApiBase {
$params = $this->extractRequestParams();
$this->requireAtLeastOneParameter( $params, 'page', 'oldid' );
if ( isset( $params['page'] ) ) {
$title = Title::newFromText( $params['page'] );
if ( !$title ) {
$this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $params['page'] ) ] );
}
if ( !HookUtils::isAvailableForTitle( $title ) ) {
$this->getResult()->addValue(
null,
$this->getModuleName(),
[ 'transcludedfrom' => [] ]
);
return;
}
}
if ( isset( $params['oldid'] ) ) {
$revision = $this->revisionLookup->getRevisionById( $params['oldid'] );
if ( !$revision ) {