}
}
+ $title = $params['title'];
+ if ( !is_null( $title ) ) {
+ $titleObj = Title::newFromText( $title );
+ if ( is_null( $titleObj ) ) {
+ $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $title ) ] );
+ }
+ $this->addWhereFld( 'rc_namespace', $titleObj->getNamespace() );
+ $this->addWhereFld( 'rc_title', $titleObj->getDBkey() );
+ }
+
if ( !is_null( $params['show'] ) ) {
$show = array_flip( $params['show'] );
ApiBase::PARAM_TYPE => RecentChange::getChangeTypes()
],
'toponly' => false,
+ 'title' => null,
'continue' => [
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
],
"apihelp-query+recentchanges-param-limit": "How many total changes to return.",
"apihelp-query+recentchanges-param-type": "Which types of changes to show.",
"apihelp-query+recentchanges-param-toponly": "Only list changes which are the latest revision.",
+ "apihelp-query+recentchanges-param-title": "Filter entries to those related to a page.",
"apihelp-query+recentchanges-param-generaterevisions": "When being used as a generator, generate revision IDs rather than titles. Recent change entries without associated revision IDs (e.g. most log entries) will generate nothing.",
"apihelp-query+recentchanges-example-simple": "List recent changes.",
"apihelp-query+recentchanges-example-generator": "Get page info about recent unpatrolled changes.",
"apihelp-query+recentchanges-param-limit": "{{doc-apihelp-param|query+recentchanges|limit}}",
"apihelp-query+recentchanges-param-type": "{{doc-apihelp-param|query+recentchanges|type}}",
"apihelp-query+recentchanges-param-toponly": "{{doc-apihelp-param|query+recentchanges|toponly}}",
+ "apihelp-query+recentchanges-param-title": "{{doc-apihelp-param|query+recentchanges|title}}",
"apihelp-query+recentchanges-param-generaterevisions": "{{doc-apihelp-param|query+recentchanges|generaterevisions}}",
"apihelp-query+recentchanges-example-simple": "{{doc-apihelp-example|query+recentchanges}}",
"apihelp-query+recentchanges-example-generator": "{{doc-apihelp-example|query+recentchanges}}",
);
}
+ public function testTitleParams() {
+ $page1 = new TitleValue( 0, 'ApiQueryRecentChangesIntegrationTestPage' );
+ $page2 = new TitleValue( 1, 'ApiQueryRecentChangesIntegrationTestPage2' );
+ $page3 = new TitleValue( 0, 'ApiQueryRecentChangesIntegrationTestPage3' );
+ $this->doPageEdits(
+ $this->getLoggedInTestUser(),
+ [
+ [
+ 'target' => $page1,
+ 'summary' => 'Create the page',
+ ],
+ [
+ 'target' => $page2,
+ 'summary' => 'Create the page',
+ ],
+ [
+ 'target' => $page3,
+ 'summary' => 'Create the page',
+ ],
+ ]
+ );
+
+ $result = $this->doListRecentChangesRequest(
+ [
+ 'rctitle' => 'ApiQueryRecentChangesIntegrationTestPage',
+ 'rcprop' => 'title'
+ ]
+ );
+
+ $result2 = $this->doListRecentChangesRequest(
+ [
+ 'rctitle' => 'Talk:ApiQueryRecentChangesIntegrationTestPage2',
+ 'rcprop' => 'title'
+ ]
+ );
+
+ $this->assertEquals(
+ [
+ [
+ 'type' => 'new',
+ 'ns' => $page1->getNamespace(),
+ 'title' => $this->getPrefixedText( $page1 )
+ ],
+ ],
+ $this->getItemsFromApiResponse( $result )
+ );
+
+ $this->assertEquals(
+ [
+ [
+ 'type' => 'new',
+ 'ns' => $page2->getNamespace(),
+ 'title' => $this->getPrefixedText( $page2 )
+ ],
+ ],
+ $this->getItemsFromApiResponse( $result2 )
+ );
+ }
+
public function testStartEndParams() {
$target = new TitleValue( 0, 'ApiQueryRecentChangesIntegrationTestPage' );
$this->doPageEdit( $this->getLoggedInTestUser(), $target, 'Create the page' );