$v = $val;
}
if ( $flag !== null ) {
- $v[$flag] = '';
+ $v[$flag] = true;
}
$result[] = $v;
}
$this->mAllowGenerator = ( $flags & ApiPageSet::DISABLE_GENERATORS ) == 0;
$this->mDefaultNamespace = $defaultNamespace;
- $this->profileIn();
$this->mParams = $this->extractRequestParams();
$this->mResolveRedirects = $this->mParams['redirects'];
$this->mConvertTitles = $this->mParams['converttitles'];
- $this->profileOut();
}
/**
* relevant parameters as used
*/
private function executeInternal( $isDryRun ) {
- $this->profileIn();
-
$generatorName = $this->mAllowGenerator ? $this->mParams['generator'] : null;
if ( isset( $generatorName ) ) {
$dbSource = $this->mDbSource;
- $isQuery = $dbSource instanceof ApiQuery;
- if ( !$isQuery ) {
+ if ( !$dbSource instanceof ApiQuery ) {
// If the parent container of this pageset is not ApiQuery, we must create it to run generator
$dbSource = $this->getMain()->getModuleManager()->getModule( 'query' );
- // Enable profiling for query module because it will be used for db sql profiling
- $dbSource->profileIn();
}
$generator = $dbSource->getModuleManager()->getModule( $generatorName, null, true );
if ( $generator === null ) {
$tmpPageSet->executeInternal( $isDryRun );
// populate this pageset with the generator output
- $this->profileOut();
- $generator->profileIn();
-
if ( !$isDryRun ) {
$generator->executeGenerator( $this );
Hooks::run( 'APIQueryGeneratorAfterExecute', array( &$generator, &$this ) );
$main->getVal( $generator->encodeParamName( $paramName ) );
}
}
- $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();
- }
} else {
// Only one of the titles/pageids/revids is allowed at the same time
$dataSource = null;
}
}
}
- $this->profileOut();
}
/**
$pageFlds['page_is_redirect'] = null;
}
+ if ( $this->getConfig()->get( 'ContentHandlerUseDB' ) ) {
+ $pageFlds['page_content_model'] = null;
+ }
+
// only store non-default fields
$this->mRequestedPageFields = array_diff_key( $this->mRequestedPageFields, $pageFlds );
$values[] = $r;
}
if ( !empty( $values ) && $result ) {
- $result->setIndexedTagName( $values, 'r' );
+ ApiResult::setIndexedTagName( $values, 'r' );
}
return $values;
);
}
if ( !empty( $values ) && $result ) {
- $result->setIndexedTagName( $values, 'n' );
+ ApiResult::setIndexedTagName( $values, 'n' );
}
return $values;
);
}
if ( !empty( $values ) && $result ) {
- $result->setIndexedTagName( $values, 'c' );
+ ApiResult::setIndexedTagName( $values, 'c' );
}
return $values;
$values[] = $item;
}
if ( !empty( $values ) && $result ) {
- $result->setIndexedTagName( $values, 'i' );
+ ApiResult::setIndexedTagName( $values, 'i' );
}
return $values;
);
}
if ( !empty( $values ) && $result ) {
- $result->setIndexedTagName( $values, 'rev' );
+ ApiResult::setIndexedTagName( $values, 'rev' );
}
return $values;
* @param array $titles Array of Title objects
*/
public function populateFromTitles( $titles ) {
- $this->profileIn();
$this->initFromTitles( $titles );
- $this->profileOut();
}
/**
* @param array $pageIDs Array of page IDs
*/
public function populateFromPageIDs( $pageIDs ) {
- $this->profileIn();
$this->initFromPageIds( $pageIDs );
- $this->profileOut();
}
/**
* @param ResultWrapper $queryResult Query result object
*/
public function populateFromQueryResult( $db, $queryResult ) {
- $this->profileIn();
$this->initFromQueryResult( $queryResult );
- $this->profileOut();
}
/**
* @param array $revIDs Array of revision IDs
*/
public function populateFromRevisionIDs( $revIDs ) {
- $this->profileIn();
$this->initFromRevIDs( $revIDs );
- $this->profileOut();
}
/**
$set = $linkBatch->constructSet( 'page', $db );
// Get pageIDs data from the `page` table
- $this->profileDBIn();
$res = $db->select( 'page', $this->getPageTableFields(), $set,
__METHOD__ );
- $this->profileDBOut();
// Hack: get the ns:titles stored in array(ns => array(titles)) format
$this->initFromQueryResult( $res, $linkBatch->data, true ); // process Titles
$db = $this->getDB();
// Get pageIDs data from the `page` table
- $this->profileDBIn();
$res = $db->select( 'page', $this->getPageTableFields(), $set,
__METHOD__ );
- $this->profileDBOut();
}
$this->initFromQueryResult( $res, $remaining, false ); // process PageIDs
$where = array( 'rev_id' => $revids, 'rev_page = page_id' );
// Get pageIDs data from the `page` table
- $this->profileDBIn();
$res = $db->select( $tables, $fields, $where, __METHOD__ );
foreach ( $res as $row ) {
$revid = intval( $row->rev_id );
$pageids[$pageid] = '';
unset( $remaining[$revid] );
}
- $this->profileDBOut();
}
$this->mMissingRevIDs = array_keys( $remaining );
$fields = array( 'ar_rev_id', 'ar_namespace', 'ar_title' );
$where = array( 'ar_rev_id' => $this->mMissingRevIDs );
- $this->profileDBIn();
$res = $db->select( $tables, $fields, $where, __METHOD__ );
$titles = array();
foreach ( $res as $row ) {
$titles[$revid] = Title::makeTitle( $row->ar_namespace, $row->ar_title );
unset( $remaining[$revid] );
}
- $this->profileDBOut();
$this->initFromTitles( $titles );
}
// Get pageIDs data from the `page` table
- $this->profileDBIn();
$res = $db->select( 'page', $pageFlds, $set, __METHOD__ );
- $this->profileDBOut();
// Hack: get the ns:titles stored in array(ns => array(titles)) format
$this->initFromQueryResult( $res, $linkBatch->data, true );
$lb = new LinkBatch();
$db = $this->getDB();
- $this->profileDBIn();
$res = $db->select(
'redirect',
array(
), array( 'rd_from' => array_keys( $this->mPendingRedirectIDs ) ),
__METHOD__
);
- $this->profileDBOut();
foreach ( $res as $row ) {
$rdfrom = intval( $row->rd_from );
$from = $this->mPendingRedirectIDs[$rdfrom]->getPrefixedText();
*/
public function populateGeneratorData( &$result, array $path = array() ) {
if ( $result instanceof ApiResult ) {
- $data = $result->getData();
+ $data = $result->getResultData( $path );
+ if ( $data === null ) {
+ return true;
+ }
} else {
$data = &$result;
- }
- foreach ( $path as $key ) {
- if ( !isset( $data[$key] ) ) {
- // Path isn't in $result, so nothing to add, so everything
- // "fits"
- return true;
+ foreach ( $path as $key ) {
+ if ( !isset( $data[$key] ) ) {
+ // Path isn't in $result, so nothing to add, so everything
+ // "fits"
+ return true;
+ }
+ $data = &$data[$key];
}
- $data = &$data[$key];
}
foreach ( $this->mGeneratorData as $ns => $dbkeys ) {
if ( $ns === -1 ) {