}
$resultData = $reporter->getData();
- $this->getResult()->setIndexedTagName( $resultData, 'page' );
- $this->getResult()->addValue( null, $this->getModuleName(), $resultData );
+ $result = $this->getResult();
+ $result->setIndexedTagName( $resultData, 'page' );
+ $result->addValue( null, $this->getModuleName(), $resultData );
}
public function mustBePosted() {
* @return string
*/
protected function substituteResultWithError( $e ) {
+ $result = $this->getResult();
// Printer may not be initialized if the extractRequestParams() fails for the main module
if ( !isset ( $this->mPrinter ) ) {
// The printer has not been created yet. Try to manually get formatter value.
$this->mPrinter = $this->createPrinterByName( $value );
if ( $this->mPrinter->getNeedsRawData() ) {
- $this->getResult()->setRawMode();
+ $result->setRawMode();
}
}
ApiResult::setContent( $errMessage, $wgShowExceptionDetails ? "\n\n{$e->getTraceAsString()}\n\n" : '' );
}
- $this->getResult()->reset();
- $this->getResult()->disableSizeCheck();
+ $result->reset();
+ $result->disableSizeCheck();
// Re-add the id
$requestid = $this->getParameter( 'requestid' );
if ( !is_null( $requestid ) ) {
- $this->getResult()->addValue( null, 'requestid', $requestid );
+ $result->addValue( null, 'requestid', $requestid );
}
// servedby is especially useful when debugging errors
- $this->getResult()->addValue( null, 'servedby', wfHostName() );
- $this->getResult()->addValue( null, 'error', $errMessage );
+ $result->addValue( null, 'servedby', wfHostName() );
+ $result->addValue( null, 'error', $errMessage );
return $errMessage['code'];
}
*/
protected function setupExecuteAction() {
// First add the id to the top element
+ $result = $this->getResult();
$requestid = $this->getParameter( 'requestid' );
if ( !is_null( $requestid ) ) {
- $this->getResult()->addValue( null, 'requestid', $requestid );
+ $result->addValue( null, 'requestid', $requestid );
}
$servedby = $this->getParameter( 'servedby' );
if ( $servedby ) {
- $this->getResult()->addValue( null, 'servedby', wfHostName() );
+ $result->addValue( null, 'servedby', wfHostName() );
}
$params = $this->extractRequestParams();
}
}
+ $result = $this->getResult();
+
// Move subpages
if ( $params['movesubpages'] ) {
$r['subpages'] = $this->moveSubpages( $fromTitle, $toTitle,
$params['reason'], $params['noredirect'] );
- $this->getResult()->setIndexedTagName( $r['subpages'], 'subpage' );
+ $result->setIndexedTagName( $r['subpages'], 'subpage' );
+
if ( $params['movetalk'] ) {
$r['subpages-talk'] = $this->moveSubpages( $fromTalk, $toTalk,
$params['reason'], $params['noredirect'] );
- $this->getResult()->setIndexedTagName( $r['subpages-talk'], 'subpage' );
+ $result->setIndexedTagName( $r['subpages-talk'], 'subpage' );
}
}
$this->setWatch( $watch, $fromTitle, 'watchmoves' );
$this->setWatch( $watch, $toTitle, 'watchmoves' );
- $this->getResult()->addValue( null, $this->getModuleName(), $r );
+ $result->addValue( null, $this->getModuleName(), $r );
}
/**
$redirValues = null;
+ // Return result
+ $result = $this->getResult();
+
if ( !is_null( $oldid ) || !is_null( $pageid ) || !is_null( $page ) ) {
if ( !is_null( $oldid ) ) {
// Don't use the parser cache
if ( $params['onlypst'] ) {
// Build a result and bail out
$result_array['text'] = array();
- $this->getResult()->setContent( $result_array['text'], $this->pstText );
+ $result->setContent( $result_array['text'], $this->pstText );
if ( isset( $prop['wikitext'] ) ) {
$result_array['wikitext'] = array();
- $this->getResult()->setContent( $result_array['wikitext'], $this->text );
+ $result->setContent( $result_array['wikitext'], $this->text );
}
- $this->getResult()->addValue( null, $this->getModuleName(), $result_array );
+ $result->addValue( null, $this->getModuleName(), $result_array );
return;
}
$p_result = $wgParser->parse( $params['pst'] ? $this->pstText : $this->text, $titleObj, $popts );
}
- // Return result
- $result = $this->getResult();
$result_array = array();
$result_array['title'] = $titleObj->getPrefixedText();
$res['cascade'] = '';
}
$res['protections'] = $resultProtections;
- $this->getResult()->setIndexedTagName( $res['protections'], 'protection' );
- $this->getResult()->addValue( null, $this->getModuleName(), $res );
+ $result = $this->getResult();
+ $result->setIndexedTagName( $res['protections'], 'protection' );
+ $result->addValue( null, $this->getModuleName(), $res );
}
public function mustBePosted() {
$article = Article::newFromTitle( $title, $context );
$article->doPurge(); // Directly purge and skip the UI part of purge().
$r['purged'] = '';
-
+
if( $forceLinkUpdate ) {
if ( !$wgUser->pingLimiter() ) {
global $wgParser, $wgEnableParserCache;
$forceLinkUpdate = false;
}
}
-
+
$result[] = $r;
}
- $this->getResult()->setIndexedTagName( $result, 'page' );
- $this->getResult()->addValue( null, $this->getModuleName(), $result );
+ $apiResult = $this->getResult();
+ $apiResult->setIndexedTagName( $result, 'page' );
+ $apiResult->addValue( null, $this->getModuleName(), $result );
}
public function isWriteMode() {
$this->redirect = isset( $this->params['redirect'] ) && $this->params['redirect'];
$userMax = ( $this->redirect ? ApiBase::LIMIT_BIG1 / 2 : ApiBase::LIMIT_BIG1 );
$botMax = ( $this->redirect ? ApiBase::LIMIT_BIG2 / 2 : ApiBase::LIMIT_BIG2 );
+
+ $result = $this->getResult();
+
if ( $this->params['limit'] == 'max' ) {
$this->params['limit'] = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
- $this->getResult()->setParsedLimit( $this->getModuleName(), $this->params['limit'] );
+ $result->setParsedLimit( $this->getModuleName(), $this->params['limit'] );
}
$this->processContinue();
}
if ( is_null( $resultPageSet ) ) {
// Try to add the result data in one go and pray that it fits
- $fit = $this->getResult()->addValue( 'query', $this->getModuleName(), array_values( $this->resultArr ) );
+ $fit = $result->addValue( 'query', $this->getModuleName(), array_values( $this->resultArr ) );
if ( !$fit ) {
// It didn't fit. Add elements one by one until the
// result is full.
foreach ( $this->resultArr as $pageID => $arr ) {
// Add the basic entry without redirlinks first
- $fit = $this->getResult()->addValue(
+ $fit = $result->addValue(
array( 'query', $this->getModuleName() ),
null, array_diff_key( $arr, array( 'redirlinks' => '' ) ) );
if ( !$fit ) {
$hasRedirs = false;
$redirLinks = isset( $arr['redirlinks'] ) ? $arr['redirlinks'] : array();
foreach ( (array)$redirLinks as $key => $redir ) {
- $fit = $this->getResult()->addValue(
+ $fit = $result->addValue(
array( 'query', $this->getModuleName(), $pageID, 'redirlinks' ),
$key, $redir );
if ( !$fit ) {
$hasRedirs = true;
}
if ( $hasRedirs ) {
- $this->getResult()->setIndexedTagName_internal(
+ $result->setIndexedTagName_internal(
array( 'query', $this->getModuleName(), $pageID, 'redirlinks' ),
$this->bl_code );
}
}
}
- $this->getResult()->setIndexedTagName_internal(
+ $result->setIndexedTagName_internal(
array( 'query', $this->getModuleName() ),
$this->bl_code
);
protected function setContinueEnumParameter( $paramName, $paramValue ) {
$paramName = $this->encodeParamName( $paramName );
$msg = array( $paramName => $paramValue );
- $this->getResult()->disableSizeCheck();
- $this->getResult()->addValue( 'query-continue', $this->getModuleName(), $msg );
- $this->getResult()->enableSizeCheck();
+ $result = $this->getResult();
+ $result->disableSizeCheck();
+ $result->addValue( 'query-continue', $this->getModuleName(), $msg );
+ $result->enableSizeCheck();
}
/**
'by the previous query', '_badcontinue'
);
}
-
+
// Remove the types to skip from $queryTypes
$contTypeIndex = array_search( $cont[0], $queryTypes );
$queryTypes = array_slice( $queryTypes, $contTypeIndex );
-
+
// Add a WHERE clause for sortkey and from
// pack( "H*", $foo ) is used to convert hex back to binary
$escSortkey = $this->getDB()->addQuotes( pack( "H*", $cont[1] ) );
$contWhere = "cl_sortkey $op $escSortkey OR " .
"(cl_sortkey = $escSortkey AND " .
"cl_from $op= $from)";
-
+
} else {
// The below produces ORDER BY cl_sortkey, cl_from, possibly with DESC added to each of them
$this->addWhereRange( 'cl_sortkey',
$res = $this->select( __METHOD__ );
$rows = iterator_to_array( $res );
}
+
+ $result = $this->getResult();
$count = 0;
foreach ( $rows as $row ) {
if ( ++ $count > $limit ) {
if ( $fld_timestamp ) {
$vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->cl_timestamp );
}
- $fit = $this->getResult()->addValue( array( 'query', $this->getModuleName() ),
+ $fit = $result->addValue( array( 'query', $this->getModuleName() ),
null, $vals );
if ( !$fit ) {
if ( $params['sort'] == 'timestamp' ) {
}
if ( is_null( $resultPageSet ) ) {
- $this->getResult()->setIndexedTagName_internal(
+ $result->setIndexedTagName_internal(
array( 'query', $this->getModuleName() ), 'cm' );
}
}
$titles = array();
+ $result = $this->getResult();
+
/* Iterate through the rows, adding data extracted from them to our query result. */
foreach ( $res as $row ) {
if ( ++ $count > $params['limit'] ) {
if ( !$vals ) {
continue;
}
- $fit = $this->getResult()->addValue( array( 'query', $this->getModuleName() ), null, $vals );
+ $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals );
if ( !$fit ) {
$this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) );
break;
if ( is_null( $resultPageSet ) ) {
/* Format the result */
- $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'rc' );
+ $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'rc' );
} else {
$resultPageSet->populateFromTitles( $titles );
}
$this->dieUsage( "{$what} search is disabled", "search-{$what}-disabled" );
}
+ $result = $this->getResult();
// Add search meta data to result
if ( isset( $searchInfo['totalhits'] ) ) {
$totalhits = $matches->getTotalHits();
if ( $totalhits !== null ) {
- $this->getResult()->addValue( array( 'query', 'searchinfo' ),
+ $result->addValue( array( 'query', 'searchinfo' ),
'totalhits', $totalhits );
}
}
if ( isset( $searchInfo['suggestion'] ) && $matches->hasSuggestion() ) {
- $this->getResult()->addValue( array( 'query', 'searchinfo' ),
+ $result->addValue( array( 'query', 'searchinfo' ),
'suggestion', $matches->getSuggestionQuery() );
}
}
// Add item to results and see whether it fits
- $fit = $this->getResult()->addValue( array( 'query', $this->getModuleName() ),
+ $fit = $result->addValue( array( 'query', $this->getModuleName() ),
null, $vals );
if ( !$fit ) {
$this->setContinueEnumParameter( 'offset', $params['offset'] + $count - 1 );
}
if ( is_null( $resultPageSet ) ) {
- $this->getResult()->setIndexedTagName_internal( array(
+ $result->setIndexedTagName_internal( array(
'query', $this->getModuleName()
), 'p' );
} else {
global $wgGroupPermissions, $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
$data = array();
+ $result = $this->getResult();
foreach ( $wgGroupPermissions as $group => $permissions ) {
$arr = array(
'name' => $group,
foreach ( $groupArr as $type => $rights ) {
if ( isset( $rights[$group] ) ) {
$arr[$type] = $rights[$group];
- $this->getResult()->setIndexedTagName( $arr[$type], 'group' );
+ $result->setIndexedTagName( $arr[$type], 'group' );
}
}
- $this->getResult()->setIndexedTagName( $arr['rights'], 'permission' );
+ $result->setIndexedTagName( $arr['rights'], 'permission' );
$data[] = $arr;
}
- $this->getResult()->setIndexedTagName( $data, 'group' );
- return $this->getResult()->addValue( 'query', $property, $data );
+ $result->setIndexedTagName( $data, 'group' );
+ return $result->addValue( 'query', $property, $data );
}
protected function appendFileExtensions( $property ) {