X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=blobdiff_plain;f=includes%2Fchangetags%2FChangeTags.php;h=dd29c100e8ac5214676186940183bbe155082f05;hb=abe264e9b8b360e8bc500f700f4a2ac075438b67;hp=787464084937db0b77ef63cd1715dc51afb8b946;hpb=03608896716851972cc22d28d432d233be10edba;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index 7874640849..dd29c100e8 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -201,9 +201,8 @@ class ChangeTags { } $taglessDesc = Sanitizer::stripAllTags( $originalDesc->parse() ); - $escapedDesc = Sanitizer::escapeHtmlAllowEntities( $taglessDesc ); - return $context->getLanguage()->truncateForVisual( $escapedDesc, $length ); + return $context->getLanguage()->truncateForVisual( $taglessDesc, $length ); } /** @@ -916,8 +915,8 @@ class ChangeTags { if ( $wgChangeTagsSchemaMigrationStage > MIGRATION_OLD ) { $dbw->update( 'change_tag_def', - [ 'ctd_name' => $tag ], [ 'ctd_user_defined' => 0 ], + [ 'ctd_name' => $tag ], __METHOD__ ); @@ -1184,7 +1183,7 @@ class ChangeTags { * Extensions should NOT use this function; they can use the ListDefinedTags * hook instead. * - * Includes a call to ChangeTag::canDeleteTag(), so your code doesn't need to + * Includes a call to ChangeTag::canCreateTag(), so your code doesn't need to * do that. * * @param string $tag @@ -1507,6 +1506,13 @@ class ChangeTags { * @return array Array of string => int */ public static function tagUsageStatistics() { + global $wgChangeTagsSchemaMigrationStage, $wgTagStatisticsNewTable; + if ( $wgChangeTagsSchemaMigrationStage > MIGRATION_WRITE_BOTH || + ( $wgTagStatisticsNewTable && $wgChangeTagsSchemaMigrationStage > MIGRATION_OLD ) + ) { + return self::newTagUsageStatistics(); + } + $fname = __METHOD__; $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); return $cache->getWithSetCallback( @@ -1540,6 +1546,29 @@ class ChangeTags { ); } + /** + * Same self::tagUsageStatistics() but uses change_tag_def. + * + * @return array Array of string => int + */ + private static function newTagUsageStatistics() { + $dbr = wfGetDB( DB_REPLICA ); + $res = $dbr->select( + 'change_tag_def', + [ 'ctd_name', 'ctd_count' ], + [], + __METHOD__, + [ 'ORDER BY' => 'ctd_count DESC' ] + ); + + $out = []; + foreach ( $res as $row ) { + $out[$row->ctd_name] = $row->ctd_count; + } + + return $out; + } + /** * Indicate whether change tag editing UI is relevant *