7use InvalidArgumentException;
12use Wikimedia\Timestamp\ConvertibleTimestamp;
65 if ( !$user->isRegistered() ) {
69 $userId = $user->
getId();
70 $cacheKey =
'u' . (string)$userId;
72 if ( isset( $this->userEditCountCache[ $cacheKey ] ) ) {
73 return $this->userEditCountCache[ $cacheKey ];
77 $count =
$dbr->selectField(
80 [
'user_id' => $userId ],
84 if ( $count ===
null ) {
89 $this->userEditCountCache[ $cacheKey ] = $count;
100 $actorWhere = $this->actorMigration->getWhere(
$dbr,
'rev_user', $user );
102 $count = (int)
$dbr->selectField(
103 [
'revision' ] + $actorWhere[
'tables'],
105 [ $actorWhere[
'conds'] ],
113 'userId' => $user->
getId(),
114 'editCount' => $count,
132 DeferredUpdates::addUpdate(
134 DeferredUpdates::POSTSEND
146 return $this->getUserEditTimestamp( $user, self::FIRST_EDIT );
157 return $this->getUserEditTimestamp( $user, self::LATEST_EDIT );
168 if ( $user->
getId() === 0 ) {
173 $actorWhere = $this->actorMigration->getWhere(
$dbr,
'rev_user', $user );
175 $tsField = isset( $actorWhere[
'tables'][
'temp_rev_user'] )
176 ?
'revactor_timestamp' :
'rev_timestamp';
178 $sortOrder = (
$type === self::FIRST_EDIT ) ?
'ASC' :
'DESC';
179 $time =
$dbr->selectField(
180 [
'revision' ] + $actorWhere[
'tables'],
182 [ $actorWhere[
'conds'] ],
184 [
'ORDER BY' =>
"$tsField $sortOrder" ],
192 return ConvertibleTimestamp::convert( TS_MW, $time );
204 $userId = $user->
getId();
205 $cacheKey =
'u' . (string)$userId;
207 unset( $this->userEditCountCache[ $cacheKey ] );
218 throw new InvalidArgumentException( __METHOD__ .
' with an anonymous user' );
221 $userId = $user->
getId();
222 $cacheKey =
'u' . (string)$userId;
224 $this->userEditCountCache[ $cacheKey ] = $editCount;
if(ini_get('mbstring.func_overload')) if(!defined('MW_ENTRY_POINT'))
Pre-config setup: Before loading LocalSettings.php.
This is not intended to be a long-term part of MediaWiki; it will be deprecated and removed once acto...
Class for managing the deferral of updates within the scope of a PHP script invocation.
Class to handle enqueueing of background jobs.
Job that initializes an user's edit count if it's not yet set or the current value is outdated.
Handles increment the edit count for a given set of users.