API: Allow querying linterrors by pageid

The pageid parameter limits lint errors to specific pages. Users can get
detailed lint error information of a certain page.

Bug: T181303
Change-Id: I164449254649caff29fcffa3bc7c923c20b8e837
This commit is contained in:
xyx_is 2017-11-24 23:22:10 +09:00 committed by Kunal Mehta
parent 2c08143ed0
commit a262956017
3 changed files with 9 additions and 0 deletions

View file

@ -63,6 +63,7 @@
"apihelp-query+linterrors-param-limit": "Number of results to query",
"apihelp-query+linterrors-param-from": "Lint ID to start querying from",
"apihelp-query+linterrors-param-namespace": "Only include lint errors from the specified namespaces",
"apihelp-query+linterrors-param-pageid": "Only include lint errors from the specified page IDs",
"apihelp-query+linterrors-example-1": "Get all lint errors of the obsolete-tag category",
"apihelp-record-lint-description": "Record a lint error in the database",
"apihelp-record-lint-summary": "Record a lint error in the database",

View file

@ -67,6 +67,7 @@
"apihelp-query+linterrors-param-limit": "{{doc-apihelp-param|query+linterrors|limit}}",
"apihelp-query+linterrors-param-from": "{{doc-apihelp-param|query+linterrors|from}}",
"apihelp-query+linterrors-param-namespace": "{{doc-apihelp-param|query+linterrors|namespace}}",
"apihelp-query+linterrors-param-pageid": "{{doc-apihelp-param|query+linterrors|pageid}}",
"apihelp-query+linterrors-example-1": "{{doc-apihelp-example|query+linterrors}}",
"apihelp-record-lint-description": "{{doc-apihelp-description|record-lint}}",
"apihelp-record-lint-summary": "{{doc-apihelp-summary|record-lint}}",

View file

@ -43,6 +43,9 @@ class ApiQueryLintErrors extends ApiQueryBase {
if ( $params['from'] !== null ) {
$this->addWhere( 'linter_id >= ' . $db->addQuotes( $params['from'] ) );
}
if ( $params['pageid'] !== null ) {
$this->addWhereFld( 'linter_page', $params['pageid'] );
}
if ( $params['namespace'] !== null ) {
$this->addWhereFld( 'page_namespace', $params['namespace'] );
}
@ -114,6 +117,10 @@ class ApiQueryLintErrors extends ApiQueryBase {
ApiBase::PARAM_TYPE => 'namespace',
ApiBase::PARAM_ISMULTI => true,
],
'pageid' => [
ApiBase::PARAM_TYPE => 'integer',
ApiBase::PARAM_ISMULTI => true,
],
'from' => [
ApiBase::PARAM_TYPE => 'integer',
],