2declare( strict_types = 1 );
4namespace MediaWiki\Extension\Translate\Statistics;
31 $dateFormat =
'Y-m-d';
32 $scale = $this->opts->getValue(
'scale' );
33 if ( $scale ===
'years' ) {
35 } elseif ( $scale ===
'months' ) {
37 } elseif ( $scale ===
'weeks' ) {
38 $dateFormat =
'Y-\WW';
39 } elseif ( $scale ===
'hours' ) {
46 protected static function makeTimeCondition( $field, $start, $end ) {
47 $db = wfGetDB( DB_REPLICA );
50 if ( $start !==
null ) {
51 $conds[] =
"$field >= " . $db->addQuotes( $db->timestamp( $start ) );
53 if ( $end !==
null ) {
54 $conds[] =
"$field <= " . $db->addQuotes( $db->timestamp( $end ) );
67 foreach ( $groupIds as $id ) {
68 $group = MessageGroups::getGroup( $id );
70 $namespace = $group->getNamespace();
71 $namespaces[$namespace] =
true;
75 return array_keys( $namespaces );