/**
* Populate the PageSet from the request parameters.
- * @param bool $isDryRun If true, instantiates generator, but only to mark relevant parameters as used
+ * @param bool $isDryRun If true, instantiates generator, but only to mark
+ * relevant parameters as used
*/
private function executeInternal( $isDryRun ) {
$this->profileIn();
if ( !$isDryRun ) {
$generator->executeGenerator( $this );
wfRunHooks( 'APIQueryGeneratorAfterExecute', array( &$generator, &$this ) );
- $this->resolvePendingRedirects();
} else {
// Prevent warnings from being reported on these parameters
$main = $this->getMain();
$generator->profileOut();
$this->profileIn();
+ if ( !$isDryRun ) {
+ $this->resolvePendingRedirects();
+ }
+
if ( !$isQuery ) {
// If this pageset is not part of the query, we called profileIn() above
$dbSource->profileOut();
break;
case 'revids':
if ( $this->mResolveRedirects ) {
- $this->setWarning( 'Redirect resolution cannot be used together with the revids= parameter. ' .
- 'Any redirects the revids= point to have not been resolved.' );
+ $this->setWarning( 'Redirect resolution cannot be used ' .
+ 'together with the revids= parameter. Any redirects ' .
+ 'the revids= point to have not been resolved.' );
}
$this->mResolveRedirects = false;
$this->initFromRevIDs( $this->mParams['revids'] );
if ( isset( $this->mParams['revids'] ) ) {
return 'revids';
}
+
return null;
}
$this->mRequestedPageFields = array_diff_key( $this->mRequestedPageFields, $pageFlds );
$pageFlds = array_merge( $pageFlds, $this->mRequestedPageFields );
+
return array_keys( $pageFlds );
}
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'r' );
}
+
return $values;
}
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'n' );
}
+
return $values;
}
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'c' );
}
+
return $values;
}
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'i' );
}
+
return $values;
}
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'rev' );
}
+
return $values;
}
/**
* Extract all requested fields from the row received from the database
- * @param $row Result row
+ * @param stdClass $row Result row
*/
public function processDbRow( $row ) {
// Store Title object in various data structures
// Get pageIDs data from the `page` table
$this->profileDBIn();
$res = $db->select( 'page', $this->getPageTableFields(), $set,
- __METHOD__ );
+ __METHOD__ );
$this->profileDBOut();
// Hack: get the ns:titles stored in array(ns => array(titles)) format
// Get pageIDs data from the `page` table
$this->profileDBIn();
$res = $db->select( 'page', $this->getPageTableFields(), $set,
- __METHOD__ );
+ __METHOD__ );
$this->profileDBOut();
}
foreach ( $res as $row ) {
$rdfrom = intval( $row->rd_from );
$from = $this->mPendingRedirectIDs[$rdfrom]->getPrefixedText();
- $to = Title::makeTitle( $row->rd_namespace, $row->rd_title, $row->rd_fragment, $row->rd_interwiki );
+ $to = Title::makeTitle(
+ $row->rd_namespace,
+ $row->rd_title,
+ $row->rd_fragment,
+ $row->rd_interwiki
+ );
unset( $this->mPendingRedirectIDs[$rdfrom] );
if ( !$to->isExternal() && !isset( $this->mAllPages[$row->rd_namespace][$row->rd_title] ) ) {
$lb->add( $row->rd_namespace, $row->rd_title );
unset( $this->mPendingRedirectIDs[$id] );
}
}
+
return $lb;
}
// Variants checking
global $wgContLang;
if ( $this->mConvertTitles &&
- count( $wgContLang->getVariants() ) > 1 &&
- !$titleObj->exists() ) {
+ count( $wgContLang->getVariants() ) > 1 &&
+ !$titleObj->exists()
+ ) {
// Language::findVariantLink will modify titleText and titleObj into
// the canonical variant if possible
$titleText = is_string( $title ) ? $title : $titleObj->getPrefixedText();
$result['generator'] = null;
}
}
+
return $result;
}
sort( $gens );
self::$generators = $gens;
}
+
return self::$generators;
}
'titles' => 'A list of titles to work on',
'pageids' => 'A list of page IDs to work on',
'revids' => 'A list of revision IDs to work on',
- 'generator' => array( 'Get the list of pages to work on by executing the specified query module.',
- 'NOTE: generator parameter names must be prefixed with a \'g\', see examples' ),
+ 'generator' => array(
+ 'Get the list of pages to work on by executing the specified query module.',
+ 'NOTE: generator parameter names must be prefixed with a \'g\', see examples'
+ ),
'redirects' => 'Automatically resolve redirects',
- 'converttitles' => array( 'Convert titles to other variants if necessary. Only works if the wiki\'s content language supports variant conversion.',
- 'Languages that support variant conversion include ' . implode( ', ', LanguageConverter::$languagesWithVariants ) ),
+ 'converttitles' => array(
+ 'Convert titles to other variants if necessary. Only works if ' .
+ 'the wiki\'s content language supports variant conversion.',
+ 'Languages that support variant conversion include ' .
+ implode( ', ', LanguageConverter::$languagesWithVariants )
+ ),
);
}
public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
- array( 'code' => 'multisource', 'info' => "Cannot use 'pageids' at the same time as 'dataSource'" ),
- array( 'code' => 'multisource', 'info' => "Cannot use 'revids' at the same time as 'dataSource'" ),
- array( 'code' => 'badgenerator', 'info' => 'Module $generatorName cannot be used as a generator' ),
+ array(
+ 'code' => 'multisource',
+ 'info' => "Cannot use 'pageids' at the same time as 'dataSource'"
+ ),
+ array(
+ 'code' => 'multisource',
+ 'info' => "Cannot use 'revids' at the same time as 'dataSource'"
+ ),
+ array(
+ 'code' => 'badgenerator',
+ 'info' => 'Module $generatorName cannot be used as a generator'
+ ),
) );
}
}