From 00f5ba5db434c63a77c61f7b1aeb873a4b020151 Mon Sep 17 00:00:00 2001 From: Amir Sarabadani Date: Mon, 19 Dec 2022 08:24:33 +0100 Subject: [PATCH] Emergency: discussiontoolspageinfo return empty response in non-talk ns Bug: T325477 Change-Id: Ia7c8cca8051c800646c0f403065589f682d1ff17 --- includes/ApiDiscussionToolsPageInfo.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/includes/ApiDiscussionToolsPageInfo.php b/includes/ApiDiscussionToolsPageInfo.php index ffe6cd098..aaeadcf79 100644 --- a/includes/ApiDiscussionToolsPageInfo.php +++ b/includes/ApiDiscussionToolsPageInfo.php @@ -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 ) {