79 $dbProvider ??= $services->getConnectionProvider();
82 $linkRenderer ?? $services->getLinkRenderer(),
83 $linkBatchFactory ?? $services->getLinkBatchFactory(),
84 $hookContainer ?? $services->getHookContainer(),
86 $namespaceInfo ?? $services->getNamespaceInfo(),
87 $commentFormatter ?? $services->getCommentFormatter(),
88 $services->getUserFactory(),
104 private function getTargetTable() {
106 $ipRangeConds = $this->targetUser->isRegistered()
107 ? null : $this->getIpRangeConds( $dbr, $this->target );
108 if ( $ipRangeConds ) {
116 $revQuery = $this->revisionStore->getQueryInfo( [
'page',
'user' ] );
118 'tables' => $revQuery[
'tables'],
119 'fields' => array_merge( $revQuery[
'fields'], [
'page_is_new' ] ),
122 'join_conds' => $revQuery[
'joins'],
126 $ipRangeConds = !$this->targetUser->isRegistered() ?
127 $this->getIpRangeConds( $this->
getDatabase(), $this->target ) :
129 if ( $ipRangeConds ) {
131 array_unshift( $queryInfo[
'tables'],
'ip_changes' );
132 $queryInfo[
'join_conds'][
'revision'] = [
133 'JOIN', [
'rev_id = ipc_rev_id' ]
135 $queryInfo[
'conds'][] = $ipRangeConds;
137 $queryInfo[
'conds'][
'actor_name'] = $this->targetUser->getName();
139 $queryInfo[
'options'][
'USE INDEX'][
'revision'] =
'rev_actor_timestamp';
151 private function getIpRangeConds( $db, $ip ) {
153 if ( !self::isQueryableRange( $ip, $this->
getConfig() ) ) {
157 [ $start, $end ] = IPUtils::parseRange( $ip );
159 return $db->expr(
'ipc_hex',
'>=', $start )->and(
'ipc_hex',
'<=', $end );
174 $bits = IPUtils::parseCIDR( $ipRange )[1];
176 ( $bits ===
false ) ||
177 ( IPUtils::isIPv4( $ipRange ) && $bits < $limits[
'IPv4'] ) ||
178 ( IPUtils::isIPv6( $ipRange ) && $bits < $limits[
'IPv6'] )
194 $target = $this->getTargetTable();
197 return 'rev_timestamp';
199 return 'ipc_rev_timestamp';
202 __METHOD__ .
": Unknown value '$target' from " . static::class .
'::getTargetTable()', 0
204 return 'rev_timestamp';
216 $target = $this->getTargetTable();
221 return [
'ipc_rev_id' ];
224 __METHOD__ .
": Unknown value '$target' from " . static::class .
'::getTargetTable()', 0
237 $start = $opts[
'start'] ??
'';
238 $end = $opts[
'end'] ??
'';
239 $year = $opts[
'year'] ??
'';
240 $month = $opts[
'month'] ??
'';
242 if ( $start !==
'' && $end !==
'' && $start > $end ) {
249 if ( $year !==
'' || $month !==
'' ) {
254 $legacyDateTime =
new DateTime( $legacyTimestamp->getTimestamp( TS_ISO_8601 ) );
255 $legacyDateTime = $legacyDateTime->modify(
'-1 day' );
260 $end = $legacyDateTime->format(
'Y-m-d' );
263 $opts[
'start'] = $start;
274class_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.
A class containing constants representing the names of configuration variables.
const RangeContributionsCIDRLimit
Name constant for the RangeContributionsCIDRLimit setting, for use with Config::get()
Interface for objects which can provide a MediaWiki context on request.