X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryBase.php;h=1d4cff91095bf0bc08859b34f6e869ad095cb25a;hb=bfe07bed33f353a6490899adea0408be2805b942;hp=65e10ab72980e2458046401ae5b7be2e851d198e;hpb=bf820fca0ebafaf2caf046fa6cef789f38a88af6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 65e10ab729..1d4cff9109 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -70,6 +70,10 @@ abstract class ApiQueryBase extends ApiBase { /** * Override this method to request extra fields from the pageSet * using $pageSet->requestField('fieldName') + * + * Note this only makes sense for 'prop' modules, as 'list' and 'meta' + * modules should not be using the pageset. + * * @param ApiPageSet $pageSet */ public function requestExtraData( $pageSet ) { @@ -90,6 +94,13 @@ abstract class ApiQueryBase extends ApiBase { return $this->mQueryModule; } + /** + * @see ApiBase::getParent() + */ + public function getParent() { + return $this->getQuery(); + } + /** * Get the Query database connection (read-only) * @return DatabaseBase @@ -361,12 +372,7 @@ abstract class ApiQueryBase extends ApiBase { isset( $extraQuery['join_conds'] ) ? (array)$extraQuery['join_conds'] : array() ); - // getDB has its own profileDBIn/Out calls - $db = $this->getDB(); - - $this->profileDBIn(); - $res = $db->select( $tables, $fields, $where, $method, $options, $join_conds ); - $this->profileDBOut(); + $res = $this->getDB()->select( $tables, $fields, $where, $method, $options, $join_conds ); return $res; } @@ -502,7 +508,8 @@ abstract class ApiQueryBase extends ApiBase { */ public function titlePartToKey( $titlePart, $namespace = NS_MAIN ) { $t = Title::makeTitleSafe( $namespace, $titlePart . 'x' ); - if ( !$t ) { + if ( !$t || $t->hasFragment() ) { + // Invalid title (e.g. bad chars) or contained a '#'. $this->dieUsageMsg( array( 'invalidtitle', $titlePart ) ); } if ( $namespace != $t->getNamespace() || $t->isExternal() ) { @@ -578,7 +585,6 @@ abstract class ApiQueryBase extends ApiBase { protected function checkRowCount() { wfDeprecated( __METHOD__, '1.24' ); $db = $this->getDB(); - $this->profileDBIn(); $rowcount = $db->estimateRowCount( $this->tables, $this->fields, @@ -586,7 +592,6 @@ abstract class ApiQueryBase extends ApiBase { __METHOD__, $this->options ); - $this->profileDBOut(); if ( $rowcount > $this->getConfig()->get( 'APIMaxDBRows' ) ) { return false; @@ -711,6 +716,17 @@ abstract class ApiQueryGeneratorBase extends ApiQueryBase { } } + /** + * @see ApiBase::getHelpFlags() + * + * Corresponding messages: api-help-flag-generator + */ + protected function getHelpFlags() { + $flags = parent::getHelpFlags(); + $flags[] = 'generator'; + return $flags; + } + /** * Execute this module as a generator * @param ApiPageSet $resultPageSet All output should be appended to this object