X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryBase.php;h=77fcc61a993c43a6f6765ee9cf56cac14cb9fdc0;hb=9a05babfa5d53ff7264b0a615f202c6d2e1bf5ba;hp=01968c2a4fb83610a8de5996973ce2028990176e;hpb=3e56db4dd590e4c10b8cee202fd31de64a5e4c42;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 01968c2a4f..77fcc61a99 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -581,182 +581,4 @@ abstract class ApiQueryBase extends ApiBase { } /**@}*/ - - /************************************************************************//** - * @name Deprecated - * @{ - */ - - /** - * Estimate the row count for the SELECT query that would be run if we - * called select() right now, and check if it's acceptable. - * @deprecated since 1.24 - * @return bool True if acceptable, false otherwise - */ - protected function checkRowCount() { - wfDeprecated( __METHOD__, '1.24' ); - $db = $this->getDB(); - $rowcount = $db->estimateRowCount( - $this->tables, - $this->fields, - $this->where, - __METHOD__, - $this->options - ); - - if ( $rowcount > $this->getConfig()->get( 'APIMaxDBRows' ) ) { - return false; - } - - return true; - } - - /** - * Convert a title to a DB key - * @deprecated since 1.24, past uses of this were always incorrect and should - * have used self::titlePartToKey() instead - * @param string $title Page title with spaces - * @return string Page title with underscores - */ - public function titleToKey( $title ) { - wfDeprecated( __METHOD__, '1.24' ); - // Don't throw an error if we got an empty string - if ( trim( $title ) == '' ) { - return ''; - } - $t = Title::newFromText( $title ); - if ( !$t ) { - $this->dieUsageMsg( array( 'invalidtitle', $title ) ); - } - - return $t->getPrefixedDBkey(); - } - - /** - * The inverse of titleToKey() - * @deprecated since 1.24, unused and probably never needed - * @param string $key Page title with underscores - * @return string Page title with spaces - */ - public function keyToTitle( $key ) { - wfDeprecated( __METHOD__, '1.24' ); - // Don't throw an error if we got an empty string - if ( trim( $key ) == '' ) { - return ''; - } - $t = Title::newFromDBkey( $key ); - // This really shouldn't happen but we gotta check anyway - if ( !$t ) { - $this->dieUsageMsg( array( 'invalidtitle', $key ) ); - } - - return $t->getPrefixedText(); - } - - /** - * Inverse of titlePartToKey() - * @deprecated since 1.24, unused and probably never needed - * @param string $keyPart DBkey, with prefix - * @return string Key part with underscores - */ - public function keyPartToTitle( $keyPart ) { - wfDeprecated( __METHOD__, '1.24' ); - return substr( $this->keyToTitle( $keyPart . 'x' ), 0, -1 ); - } - - /** - * Gets the personalised direction parameter description - * - * @deprecated since 1.25 along with ApiBase::getParamDescription - * @param string $p ModulePrefix - * @param string $extraDirText Any extra text to be appended on the description - * @return array - */ - public function getDirectionDescription( $p = '', $extraDirText = '' ) { - return array( - "In which direction to enumerate{$extraDirText}", - " newer - List oldest first. Note: {$p}start has to be before {$p}end.", - " older - List newest first (default). Note: {$p}start has to be later than {$p}end.", - ); - } - - /**@}*/ -} - -/** - * @ingroup API - */ -abstract class ApiQueryGeneratorBase extends ApiQueryBase { - - private $mGeneratorPageSet = null; - - /** - * Switch this module to generator mode. By default, generator mode is - * switched off and the module acts like a normal query module. - * @since 1.21 requires pageset parameter - * @param ApiPageSet $generatorPageSet ApiPageSet object that the module will get - * by calling getPageSet() when in generator mode. - */ - public function setGeneratorMode( ApiPageSet $generatorPageSet ) { - if ( $generatorPageSet === null ) { - ApiBase::dieDebug( __METHOD__, 'Required parameter missing - $generatorPageSet' ); - } - $this->mGeneratorPageSet = $generatorPageSet; - } - - /** - * Get the PageSet object to work on. - * If this module is generator, the pageSet object is different from other module's - * @return ApiPageSet - */ - protected function getPageSet() { - if ( $this->mGeneratorPageSet !== null ) { - return $this->mGeneratorPageSet; - } - - return parent::getPageSet(); - } - - /** - * Overrides ApiBase to prepend 'g' to every generator parameter - * @param string $paramName Parameter name - * @return string Prefixed parameter name - */ - public function encodeParamName( $paramName ) { - if ( $this->mGeneratorPageSet !== null ) { - return 'g' . parent::encodeParamName( $paramName ); - } else { - return parent::encodeParamName( $paramName ); - } - } - - /** - * Overridden to set the generator param if in generator mode - * @param string $paramName Parameter name - * @param string|array $paramValue Parameter value - */ - protected function setContinueEnumParameter( $paramName, $paramValue ) { - if ( $this->mGeneratorPageSet !== null ) { - $this->getContinuationManager()->addGeneratorContinueParam( $this, $paramName, $paramValue ); - } else { - parent::setContinueEnumParameter( $paramName, $paramValue ); - } - } - - /** - * @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 - */ - abstract public function executeGenerator( $resultPageSet ); }