Merge "Lowered JobRunner lag check interval from 3 => 1 second"
[lhc/web/wiklou.git] / includes / api / ApiQueryBase.php
index 998cc91..89e92b8 100644 (file)
@@ -123,6 +123,7 @@ abstract class ApiQueryBase extends ApiBase {
         */
        public function selectNamedDB( $name, $db, $groups ) {
                $this->mDb = $this->getQuery()->getNamedDB( $name, $db, $groups );
+               return $this->mDb;
        }
 
        /**
@@ -372,12 +373,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;
        }
@@ -461,7 +457,7 @@ abstract class ApiQueryBase extends ApiBase {
         */
        protected function addPageSubItems( $pageId, $data ) {
                $result = $this->getResult();
-               $result->setIndexedTagName( $data, $this->getModulePrefix() );
+               ApiResult::setIndexedTagName( $data, $this->getModulePrefix() );
 
                return $result->addValue( array( 'query', 'pages', intval( $pageId ) ),
                        $this->getModuleName(),
@@ -486,7 +482,7 @@ abstract class ApiQueryBase extends ApiBase {
                if ( !$fit ) {
                        return false;
                }
-               $result->setIndexedTagName_internal( array( 'query', 'pages', $pageId,
+               $result->addIndexedTagName( array( 'query', 'pages', $pageId,
                        $this->getModuleName() ), $elemname );
 
                return true;
@@ -498,7 +494,7 @@ abstract class ApiQueryBase extends ApiBase {
         * @param string|array $paramValue Parameter value
         */
        protected function setContinueEnumParameter( $paramName, $paramValue ) {
-               $this->getResult()->setContinueParam( $this, $paramName, $paramValue );
+               $this->getContinuationManager()->addContinueParam( $this, $paramName, $paramValue );
        }
 
        /**
@@ -513,7 +509,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() ) {
@@ -589,7 +586,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,
@@ -597,7 +593,6 @@ abstract class ApiQueryBase extends ApiBase {
                        __METHOD__,
                        $this->options
                );
-               $this->profileDBOut();
 
                if ( $rowcount > $this->getConfig()->get( 'APIMaxDBRows' ) ) {
                        return false;
@@ -716,7 +711,7 @@ abstract class ApiQueryGeneratorBase extends ApiQueryBase {
         */
        protected function setContinueEnumParameter( $paramName, $paramValue ) {
                if ( $this->mGeneratorPageSet !== null ) {
-                       $this->getResult()->setGeneratorContinueParam( $this, $paramName, $paramValue );
+                       $this->getContinuationManager()->addGeneratorContinueParam( $this, $paramName, $paramValue );
                } else {
                        parent::setContinueEnumParameter( $paramName, $paramValue );
                }