97 public function run( $resultPageSet =
null ) {
98 $params = $this->extractRequestParams();
99 $result = $this->getResult();
101 $qp = $this->getSpecialPage( $params[
'page'] );
102 if ( !$qp->userCanExecute( $this->getUser() ) ) {
103 $this->dieWithError(
'apierror-specialpage-cantexecute' );
106 if ( $resultPageSet ===
null ) {
107 $r = [
'name' => $params[
'page'] ];
108 if ( $qp->isCached() ) {
109 if ( !$qp->isCacheable() ) {
110 $r[
'disabled'] =
true;
113 $ts = $qp->getCachedTimestamp();
115 $r[
'cachedtimestamp'] =
wfTimestamp( TS_ISO_8601, $ts );
117 $r[
'maxresults'] = $this->getConfig()->get( MainConfigNames::QueryCacheLimit );
120 $result->addValue( [
'query' ], $this->getModuleName(), $r );
123 if ( $qp->isCached() && !$qp->isCacheable() ) {
128 $res = $qp->doQuery( $params[
'offset'], $params[
'limit'] + 1 );
131 foreach (
$res as $row ) {
132 if ( ++$count > $params[
'limit'] ) {
134 $this->setContinueEnumParameter(
'offset', $params[
'offset'] + $params[
'limit'] );
138 $title = Title::makeTitle( $row->namespace, $row->title );
139 if ( $resultPageSet ===
null ) {
141 if ( isset( $row->value ) ) {
142 $data[
'value'] = $row->value;
143 if ( $qp->usesTimestamps() ) {
144 $data[
'timestamp'] =
wfTimestamp( TS_ISO_8601, $row->value );
147 self::addTitleInfo( $data,
$title );
149 foreach ( $row as $field => $value ) {
150 if ( !in_array( $field, [
'namespace',
'title',
'value',
'qc_type' ] ) ) {
151 $data[
'databaseResult'][$field] = $value;
155 $fit = $result->addValue( [
'query', $this->getModuleName(),
'results' ],
null, $data );
157 $this->setContinueEnumParameter(
'offset', $params[
'offset'] + $count - 1 );
164 if ( $resultPageSet ===
null ) {
165 $result->addIndexedTagName(
166 [
'query', $this->getModuleName(),
'results' ],
170 $resultPageSet->populateFromTitles( $titles );
186 ParamValidator::PARAM_TYPE => $this->queryPages,
187 ParamValidator::PARAM_REQUIRED =>
true
190 ParamValidator::PARAM_DEFAULT => 0,
194 ParamValidator::PARAM_DEFAULT => 10,
195 ParamValidator::PARAM_TYPE =>
'limit',
196 IntegerDef::PARAM_MIN => 1,