6use InvalidArgumentException;
56 if ( !$user->getId() ) {
57 throw new InvalidArgumentException(
58 __METHOD__ .
' requires Users with ids set'
62 $userId = $user->
getId();
63 $cacheKey =
'u' . (string)$userId;
65 if ( isset( $this->userEditCountCache[ $cacheKey ] ) ) {
66 return $this->userEditCountCache[ $cacheKey ];
70 $count =
$dbr->selectField(
73 [
'user_id' => $userId ],
77 if ( $count ===
null ) {
82 $this->userEditCountCache[ $cacheKey ] = $count;
94 $actorWhere = $this->actorMigration->getWhere(
$dbr,
'rev_user', $user );
96 $count = (int)
$dbr->selectField(
97 [
'revision' ] + $actorWhere[
'tables'],
99 [ $actorWhere[
'conds'] ],
105 $dbw = $this->loadBalancer->getConnectionRef(
DB_MASTER );
108 [
'user_editcount' => $count ],
110 'user_id' => $user->
getId(),
111 'user_editcount IS NULL OR user_editcount < ' . $count
127 return $this->getUserEditTimestamp( $user, self::FIRST_EDIT );
138 return $this->getUserEditTimestamp( $user, self::LATEST_EDIT );
150 if ( $user->
getId() === 0 ) {
155 $actorWhere = $this->actorMigration->getWhere(
$dbr,
'rev_user', $user );
157 $tsField = isset( $actorWhere[
'tables'][
'temp_rev_user'] )
158 ?
'revactor_timestamp' :
'rev_timestamp';
160 $sortOrder = (
$type === self::FIRST_EDIT ) ?
'ASC' :
'DESC';
161 $time =
$dbr->selectField(
162 [
'revision' ] + $actorWhere[
'tables'],
164 [ $actorWhere[
'conds'] ],
166 [
'ORDER BY' =>
"$tsField $sortOrder" ],
174 return MWTimestamp::convert( TS_MW, $time );
187 $userId = $user->
getId();
188 $cacheKey =
'u' . (string)$userId;
190 $this->userEditCountCache[ $cacheKey ] =
null;
if(ini_get('mbstring.func_overload')) if(!defined('MW_ENTRY_POINT'))
Pre-config setup: Before loading LocalSettings.php.
This class handles the logic for the actor table migration and should always be used in lieu of direc...
Library for creating and parsing MW-style timestamps.