MediaWiki  master
MediaWiki\User\UserEditTracker Class Reference

Track info about user edit counts and timings. More...

Collaboration diagram for MediaWiki\User\UserEditTracker:

Public Member Functions

 __construct (ActorMigration $actorMigration, ILoadBalancer $loadBalancer, JobQueueGroup $jobQueueGroup)
 
 clearUserEditCache (UserIdentity $user)
 
 getFirstEditTimestamp (UserIdentity $user)
 Get the user's first edit timestamp. More...
 
 getLatestEditTimestamp (UserIdentity $user)
 Get the user's latest edit timestamp. More...
 
 getUserEditCount (UserIdentity $user)
 Get a user's edit count from the user_editcount field, falling back to initialize. More...
 
 incrementUserEditCount (UserIdentity $user)
 Schedule a job to increase a user's edit count. More...
 
 initializeUserEditCount (UserIdentity $user)
 
 setCachedUserEditCount (UserIdentity $user, int $editCount)
 

Private Member Functions

 getUserEditTimestamp (UserIdentity $user, int $type)
 Get the timestamp of a user's edit, either their first or latest. More...
 

Private Attributes

ActorMigration $actorMigration
 
JobQueueGroup $jobQueueGroup
 
ILoadBalancer $loadBalancer
 
array $userEditCountCache = []
 Mapping of user id to edit count for caching To avoid using non-sequential numerical keys, keys are in the form: u⧼user id⧽ More...
 
const FIRST_EDIT = 1
 
const LATEST_EDIT = 2
 

Detailed Description

Track info about user edit counts and timings.

Since
1.35
Author
DannyS712

Definition at line 21 of file UserEditTracker.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\UserEditTracker::__construct ( ActorMigration  $actorMigration,
ILoadBalancer  $loadBalancer,
JobQueueGroup  $jobQueueGroup 
)

Member Function Documentation

◆ clearUserEditCache()

MediaWiki\User\UserEditTracker::clearUserEditCache ( UserIdentity  $user)
Access: internal
For use by User::clearInstanceCache()
Parameters
UserIdentity$user

Definition at line 199 of file UserEditTracker.php.

References MediaWiki\User\UserIdentity\getId(), and MediaWiki\User\UserIdentity\isRegistered().

◆ getFirstEditTimestamp()

MediaWiki\User\UserEditTracker::getFirstEditTimestamp ( UserIdentity  $user)

Get the user's first edit timestamp.

Parameters
UserIdentity$user
Returns
string|false Timestamp of first edit, or false for non-existent/anonymous user accounts.

Definition at line 145 of file UserEditTracker.php.

References MediaWiki\User\UserEditTracker\getUserEditTimestamp().

◆ getLatestEditTimestamp()

MediaWiki\User\UserEditTracker::getLatestEditTimestamp ( UserIdentity  $user)

Get the user's latest edit timestamp.

Parameters
UserIdentity$user
Returns
string|false Timestamp of latest edit, or false for non-existent/anonymous user accounts.

Definition at line 156 of file UserEditTracker.php.

References MediaWiki\User\UserEditTracker\getUserEditTimestamp().

◆ getUserEditCount()

MediaWiki\User\UserEditTracker::getUserEditCount ( UserIdentity  $user)

Get a user's edit count from the user_editcount field, falling back to initialize.

Parameters
UserIdentity$user
Returns
int|null Null for anonymous users

Definition at line 64 of file UserEditTracker.php.

References $dbr, DB_REPLICA, MediaWiki\User\UserIdentity\getId(), MediaWiki\User\UserEditTracker\initializeUserEditCount(), and MediaWiki\User\UserIdentity\isRegistered().

◆ getUserEditTimestamp()

MediaWiki\User\UserEditTracker::getUserEditTimestamp ( UserIdentity  $user,
int  $type 
)
private

Get the timestamp of a user's edit, either their first or latest.

Parameters
UserIdentity$user
int$typeeither self::FIRST_EDIT or ::LATEST_EDIT
Returns
string|false Timestamp of edit, or false for non-existent/anonymous user accounts.

Definition at line 167 of file UserEditTracker.php.

References $dbr, $type, DB_REPLICA, MediaWiki\User\UserEditTracker\FIRST_EDIT, and MediaWiki\User\UserIdentity\getId().

Referenced by MediaWiki\User\UserEditTracker\getFirstEditTimestamp(), and MediaWiki\User\UserEditTracker\getLatestEditTimestamp().

◆ incrementUserEditCount()

MediaWiki\User\UserEditTracker::incrementUserEditCount ( UserIdentity  $user)

Schedule a job to increase a user's edit count.

Since
1.37
Parameters
UserIdentity$user

Definition at line 126 of file UserEditTracker.php.

References DeferredUpdates\addUpdate(), and MediaWiki\User\UserIdentity\isRegistered().

◆ initializeUserEditCount()

MediaWiki\User\UserEditTracker::initializeUserEditCount ( UserIdentity  $user)
Access: internal
For use in UserEditCountUpdate class
Parameters
UserIdentity$user
Returns
int

Definition at line 98 of file UserEditTracker.php.

References $dbr, DB_REPLICA, and MediaWiki\User\UserIdentity\getId().

Referenced by MediaWiki\User\UserEditTracker\getUserEditCount().

◆ setCachedUserEditCount()

MediaWiki\User\UserEditTracker::setCachedUserEditCount ( UserIdentity  $user,
int  $editCount 
)
Access: internal
For use by User::loadFromRow() and tests
Parameters
UserIdentity$user
int$editCount
Exceptions
InvalidArgumentExceptionIf the user is not registered

Definition at line 216 of file UserEditTracker.php.

References MediaWiki\User\UserIdentity\getId(), and MediaWiki\User\UserIdentity\isRegistered().

Member Data Documentation

◆ $actorMigration

ActorMigration MediaWiki\User\UserEditTracker::$actorMigration
private

Definition at line 27 of file UserEditTracker.php.

Referenced by MediaWiki\User\UserEditTracker\__construct().

◆ $jobQueueGroup

JobQueueGroup MediaWiki\User\UserEditTracker::$jobQueueGroup
private

Definition at line 33 of file UserEditTracker.php.

Referenced by MediaWiki\User\UserEditTracker\__construct().

◆ $loadBalancer

ILoadBalancer MediaWiki\User\UserEditTracker::$loadBalancer
private

Definition at line 30 of file UserEditTracker.php.

Referenced by MediaWiki\User\UserEditTracker\__construct().

◆ $userEditCountCache

array MediaWiki\User\UserEditTracker::$userEditCountCache = []
private

Mapping of user id to edit count for caching To avoid using non-sequential numerical keys, keys are in the form: u⧼user id⧽

Definition at line 41 of file UserEditTracker.php.

◆ FIRST_EDIT

const MediaWiki\User\UserEditTracker::FIRST_EDIT = 1
private

◆ LATEST_EDIT

const MediaWiki\User\UserEditTracker::LATEST_EDIT = 2
private

Definition at line 24 of file UserEditTracker.php.


The documentation for this class was generated from the following file: