96 public function run( $resultPageSet =
null ) {
97 $params = $this->extractRequestParams();
98 $result = $this->getResult();
100 $qp = $this->getSpecialPage( $params[
'page'] );
101 if ( !$qp->userCanExecute( $this->getUser() ) ) {
102 $this->dieWithError(
'apierror-specialpage-cantexecute' );
105 $r = [
'name' => $params[
'page'] ];
106 if ( $qp->isCached() ) {
107 if ( !$qp->isCacheable() ) {
108 $r[
'disabled'] =
true;
111 $ts = $qp->getCachedTimestamp();
113 $r[
'cachedtimestamp'] =
wfTimestamp( TS_ISO_8601, $ts );
115 $r[
'maxresults'] = $this->getConfig()->get( MainConfigNames::QueryCacheLimit );
118 $result->addValue( [
'query' ], $this->getModuleName(), $r );
120 if ( $qp->isCached() && !$qp->isCacheable() ) {
125 $res = $qp->doQuery( $params[
'offset'], $params[
'limit'] + 1 );
128 foreach (
$res as $row ) {
129 if ( ++$count > $params[
'limit'] ) {
131 $this->setContinueEnumParameter(
'offset', $params[
'offset'] + $params[
'limit'] );
135 $title = Title::makeTitle( $row->namespace, $row->title );
136 if ( $resultPageSet ===
null ) {
138 if ( isset( $row->value ) ) {
139 $data[
'value'] = $row->value;
140 if ( $qp->usesTimestamps() ) {
141 $data[
'timestamp'] =
wfTimestamp( TS_ISO_8601, $row->value );
144 self::addTitleInfo( $data,
$title );
146 foreach ( $row as $field => $value ) {
147 if ( !in_array( $field, [
'namespace',
'title',
'value',
'qc_type' ] ) ) {
148 $data[
'databaseResult'][$field] = $value;
152 $fit = $result->addValue( [
'query', $this->getModuleName(),
'results' ],
null, $data );
154 $this->setContinueEnumParameter(
'offset', $params[
'offset'] + $count - 1 );
161 if ( $resultPageSet ===
null ) {
162 $result->addIndexedTagName(
163 [
'query', $this->getModuleName(),
'results' ],
167 $resultPageSet->populateFromTitles( $titles );
183 ParamValidator::PARAM_TYPE => $this->queryPages,
184 ParamValidator::PARAM_REQUIRED =>
true
187 ParamValidator::PARAM_DEFAULT => 0,
191 ParamValidator::PARAM_DEFAULT => 10,
192 ParamValidator::PARAM_TYPE =>
'limit',
193 IntegerDef::PARAM_MIN => 1,