32use MediaWiki\SpecialPage\ContributionsRangeTrait;
51 use ContributionsRangeTrait;
80 $dbProvider ??= $services->getConnectionProvider();
83 $linkRenderer ?? $services->getLinkRenderer(),
84 $linkBatchFactory ?? $services->getLinkBatchFactory(),
85 $hookContainer ?? $services->getHookContainer(),
88 $commentFormatter ?? $services->getCommentFormatter(),
89 $services->getUserFactory(),
105 private function getTargetTable() {
107 $ipRangeConds = $this->targetUser->isRegistered()
108 ? null : $this->getIpRangeConds( $dbr, $this->target );
109 if ( $ipRangeConds ) {
117 $revQuery = $this->revisionStore->getQueryInfo( [
'page',
'user' ] );
119 'tables' => $revQuery[
'tables'],
120 'fields' => array_merge( $revQuery[
'fields'], [
'page_is_new' ] ),
123 'join_conds' => $revQuery[
'joins'],
127 $ipRangeConds = !$this->targetUser->isRegistered() ?
128 $this->getIpRangeConds( $this->
getDatabase(), $this->target ) :
130 if ( $ipRangeConds ) {
132 array_unshift( $queryInfo[
'tables'],
'ip_changes' );
133 $queryInfo[
'join_conds'][
'revision'] = [
134 'JOIN', [
'rev_id = ipc_rev_id' ]
136 $queryInfo[
'conds'][] = $ipRangeConds;
138 $queryInfo[
'conds'][
'actor_name'] = $this->targetUser->getName();
140 $queryInfo[
'options'][
'USE INDEX'][
'revision'] =
'rev_actor_timestamp';
152 private function getIpRangeConds( $db, $ip ) {
154 if ( !$this->isQueryableRange( $ip, $this->
getConfig() ) ) {
158 [ $start, $end ] = IPUtils::parseRange( $ip );
160 return $db->expr(
'ipc_hex',
'>=', $start )->and(
'ipc_hex',
'<=', $end );
171 $target = $this->getTargetTable();
174 return 'rev_timestamp';
176 return 'ipc_rev_timestamp';
179 __METHOD__ .
": Unknown value '$target' from " . static::class .
'::getTargetTable()', 0
181 return 'rev_timestamp';
193 $target = $this->getTargetTable();
198 return [
'ipc_rev_id' ];
201 __METHOD__ .
": Unknown value '$target' from " . static::class .
'::getTargetTable()', 0
214 $start = $opts[
'start'] ??
'';
215 $end = $opts[
'end'] ??
'';
216 $year = $opts[
'year'] ??
'';
217 $month = $opts[
'month'] ??
'';
219 if ( $start !==
'' && $end !==
'' && $start > $end ) {
226 if ( $year !==
'' || $month !==
'' ) {
231 $legacyDateTime =
new DateTime( $legacyTimestamp->getTimestamp( TS_ISO_8601 ) );
232 $legacyDateTime = $legacyDateTime->modify(
'-1 day' );
237 $end = $legacyDateTime->format(
'Y-m-d' );
240 $opts[
'start'] = $start;
251class_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.