X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryTags.php;h=ed5fe8a5c3958bac14be2a90dd92444361a0299d;hb=8de958444f1d36ecb95d3a53d96cc1404e95468e;hp=be67dd249b196fcde918753be77e82f3260d9c3f;hpb=d42d6bd868fd5b579080639995e6a7e23851fcf3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryTags.php b/includes/api/ApiQueryTags.php index be67dd249b..ed5fe8a5c3 100644 --- a/includes/api/ApiQueryTags.php +++ b/includes/api/ApiQueryTags.php @@ -1,9 +1,5 @@ = $cont; } ); - $tags = array_fill_keys( $tags, 0 ); - } else { - $tags = $definedTags; - } - - # Merge in all used tags - $this->addTables( 'change_tag' ); - $this->addFields( 'ct_tag' ); - $this->addFields( [ 'hitcount' => $fld_hitcount ? 'COUNT(*)' : '0' ] ); - $this->addOption( 'LIMIT', $limit + 1 ); - $this->addOption( 'GROUP BY', 'ct_tag' ); - $this->addWhereRange( 'ct_tag', 'newer', $params['continue'], null ); - $res = $this->select( __METHOD__ ); - foreach ( $res as $row ) { - $tags[$row->ct_tag] = (int)$row->hitcount; } # Now make sure the array is sorted for proper continuation - ksort( $tags ); + sort( $tags ); $count = 0; - foreach ( $tags as $tagName => $hitcount ) { + foreach ( $tags as $tagName ) { if ( ++$count > $limit ) { $this->setContinueEnumParameter( 'continue', $tagName ); break; @@ -102,7 +85,7 @@ class ApiQueryTags extends ApiQueryBase { } if ( $fld_hitcount ) { - $tag['hitcount'] = $hitcount; + $tag['hitcount'] = intval( $tagHitcounts[$tagName] ); } $isSoftware = isset( $softwareDefinedTags[$tagName] ); @@ -154,9 +137,8 @@ class ApiQueryTags extends ApiQueryBase { ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 ], 'prop' => [ - ApiBase::PARAM_DFLT => 'name', + ApiBase::PARAM_DFLT => '', ApiBase::PARAM_TYPE => [ - 'name', 'displayname', 'description', 'hitcount',