X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryLogEvents.php;h=edf70022805b6009a6d01529b6bcdc717909fa56;hb=c84a5e376c6eba23c93a96d6e932e3ee9e7728a3;hp=39be2c17fd412c5b4ff16819c7449f0b54e15837;hpb=7f6bd0c6fec48474f2225bd26979815c0229813d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 39be2c17fd..edf7002280 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -42,8 +42,6 @@ class ApiQueryLogEvents extends ApiQueryBase { $fld_details = false, $fld_tags = false; public function execute() { - global $wgChangeTagsSchemaMigrationStage; - $params = $this->extractRequestParams(); $db = $this->getDB(); $this->commentStore = CommentStore::getStore(); @@ -109,25 +107,19 @@ class ApiQueryLogEvents extends ApiQueryBase { } if ( $this->fld_tags ) { - $this->addTables( 'tag_summary' ); - $this->addJoinConds( [ 'tag_summary' => [ 'LEFT JOIN', 'log_id=ts_log_id' ] ] ); - $this->addFields( 'ts_tags' ); + $this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'logging' ) ] ); } if ( !is_null( $params['tag'] ) ) { $this->addTables( 'change_tag' ); $this->addJoinConds( [ 'change_tag' => [ 'INNER JOIN', [ 'log_id=ct_log_id' ] ] ] ); - if ( $wgChangeTagsSchemaMigrationStage > MIGRATION_WRITE_BOTH ) { - $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); - try { - $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) ); - } catch ( NameTableAccessException $exception ) { - // Return nothing. - $this->addWhere( '1=0' ); - } - } else { - $this->addWhereFld( 'ct_tag', $params['tag'] ); + $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); + try { + $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) ); + } catch ( NameTableAccessException $exception ) { + // Return nothing. + $this->addWhere( '1=0' ); } } @@ -263,32 +255,6 @@ class ApiQueryLogEvents extends ApiQueryBase { $result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'item' ); } - /** - * @deprecated since 1.25 Use LogFormatter::formatParametersForApi instead - * @param ApiResult $result - * @param array &$vals - * @param string $params - * @param string $type - * @param string $action - * @param string $ts - * @param bool $legacy - * @return array - */ - public static function addLogParams( $result, &$vals, $params, $type, - $action, $ts, $legacy = false - ) { - wfDeprecated( __METHOD__, '1.25' ); - - $entry = new ManualLogEntry( $type, $action ); - $entry->setParameters( $params ); - $entry->setTimestamp( $ts ); - $entry->setLegacy( $legacy ); - $formatter = LogFormatter::newFromEntry( $entry ); - $vals['params'] = $formatter->formatParametersForApi(); - - return $vals; - } - private function extractRowInfo( $row ) { $logEntry = DatabaseLogEntry::newFromRow( $row ); $vals = [ @@ -414,6 +380,12 @@ class ApiQueryLogEvents extends ApiQueryBase { public function getAllowedParams( $flags = 0 ) { $config = $this->getConfig(); + if ( $flags & ApiBase::GET_VALUES_FOR_HELP ) { + $logActions = $this->getAllowedLogActions(); + sort( $logActions ); + } else { + $logActions = null; + } $ret = [ 'prop' => [ ApiBase::PARAM_ISMULTI => true, @@ -437,9 +409,7 @@ class ApiQueryLogEvents extends ApiQueryBase { ], 'action' => [ // validation on request is done in execute() - ApiBase::PARAM_TYPE => ( $flags & ApiBase::GET_VALUES_FOR_HELP ) - ? $this->getAllowedLogActions() - : null + ApiBase::PARAM_TYPE => $logActions ], 'start' => [ ApiBase::PARAM_TYPE => 'timestamp'