2declare( strict_types = 1 );
4namespace MediaWiki\Extension\Translate\Statistics;
7use Wikimedia\Rdbms\IDatabase;
27 global $wgTranslateMessageNamespaces;
29 $tables = [
'logging' ];
30 $fields = [
'log_timestamp' ];
34 'log_namespace' => $wgTranslateMessageNamespaces,
35 'log_action' =>
'message',
38 $timeConds = self::makeTimeCondition( $database,
'log_timestamp', $start, $end );
39 $conds = array_merge( $conds, $timeConds );
41 $options = [
'ORDER BY' =>
'log_timestamp' ];
43 $this->groups = $this->opts->getGroups();
46 if ( count( $namespaces ) ) {
47 $conds[
'log_namespace'] = $namespaces;
51 foreach ( $this->opts->getLanguages() as $code ) {
52 $languages[] =
'log_title ' . $database->buildLike( $database->anyString(),
"/$code" );
54 if ( count( $languages ) ) {
55 $conds[] = $database->makeList( $languages, LIST_OR );
58 $fields[] =
'log_title';
60 if ( $this->groups ) {
61 $fields[] =
'log_namespace';
64 if ( $this->opts->getValue(
'count' ) ===
'reviewers' ) {
65 $fields[] =
'log_actor';
72 if ( $this->opts->getValue(
'count' ) ===
'reviewers' ) {
75 if ( isset( $this->seenUsers[$date][$row->log_actor] ) ) {
79 $this->seenUsers[$date][$row->log_actor] = 1;
83 if ( !str_contains( $row->log_title,
'/' ) ) {
88 if ( !$this->groups && !$this->opts->getLanguages() ) {
98 if ( $this->groups ) {
101 $groups = $this->messageIndex->getGroupIdsForDatabaseTitle( (
int)$row->log_namespace, $key );
102 $groups = array_intersect( $this->groups, $groups );
105 if ( $this->opts->getLanguages() ) {
113 return $this->
combineTwoArrays( $this->groups, $this->opts->getLanguages() );
117 return $row->log_timestamp;