32use MediaWiki\SpecialPage\ContributionsRangeTrait;
51 use ContributionsRangeTrait;
70 $dbProvider ??= $services->getConnectionProvider();
73 $linkRenderer ?? $services->getLinkRenderer(),
74 $linkBatchFactory ?? $services->getLinkBatchFactory(),
75 $hookContainer ?? $services->getHookContainer(),
78 $commentFormatter ?? $services->getCommentFormatter(),
79 $services->getUserFactory(),
95 private function getTargetTable() {
97 $ipRangeConds = $this->targetUser->isRegistered()
98 ? null : $this->getIpRangeConds( $dbr, $this->target );
99 if ( $ipRangeConds ) {
107 $revQuery = $this->revisionStore->getQueryInfo( [
'page',
'user' ] );
109 'tables' => $revQuery[
'tables'],
110 'fields' => array_merge( $revQuery[
'fields'], [
'page_is_new' ] ),
113 'join_conds' => $revQuery[
'joins'],
117 $ipRangeConds = !$this->targetUser->isRegistered() ?
118 $this->getIpRangeConds( $this->
getDatabase(), $this->target ) :
120 if ( $ipRangeConds ) {
122 array_unshift( $queryInfo[
'tables'],
'ip_changes' );
123 $queryInfo[
'join_conds'][
'revision'] = [
124 'JOIN', [
'rev_id = ipc_rev_id' ]
126 $queryInfo[
'conds'][] = $ipRangeConds;
128 $queryInfo[
'conds'][
'actor_name'] = $this->targetUser->getName();
130 $queryInfo[
'options'][
'USE INDEX'][
'revision'] =
'rev_actor_timestamp';
142 private function getIpRangeConds( $db, $ip ) {
144 if ( !$this->isQueryableRange( $ip, $this->
getConfig() ) ) {
148 [ $start, $end ] = IPUtils::parseRange( $ip );
150 return $db->expr(
'ipc_hex',
'>=', $start )->and(
'ipc_hex',
'<=', $end );
161 $target = $this->getTargetTable();
164 return 'rev_timestamp';
166 return 'ipc_rev_timestamp';
169 __METHOD__ .
": Unknown value '$target' from " . static::class .
'::getTargetTable()', 0
171 return 'rev_timestamp';
183 $target = $this->getTargetTable();
188 return [
'ipc_rev_id' ];
191 __METHOD__ .
": Unknown value '$target' from " . static::class .
'::getTargetTable()', 0
204 $start = $opts[
'start'] ??
'';
205 $end = $opts[
'end'] ??
'';
206 $year = $opts[
'year'] ??
'';
207 $month = $opts[
'month'] ??
'';
209 if ( $start !==
'' && $end !==
'' && $start > $end ) {
216 if ( $year !==
'' || $month !==
'' ) {
221 $legacyDateTime =
new DateTime( $legacyTimestamp->getTimestamp( TS_ISO_8601 ) );
222 $legacyDateTime = $legacyDateTime->modify(
'-1 day' );
227 $end = $legacyDateTime->format(
'Y-m-d' );
230 $opts[
'start'] = $start;
241class_alias( ContribsPager::class,
'ContribsPager' );
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
Interface for objects which can provide a MediaWiki context on request.