HomePhabricator

Remove User::$mEditCount and internal caching

Description

Remove User::$mEditCount and internal caching

UserEditTracker now returns null for anonymous users
instead of throwing an exception.

Added new UserEditTracker::setCachedUserEditCount()
method (internal) to handle the user_editcount field
in User::loadFromRow()'s row. This now means that
the creation of one User object can set the cached
value for any other object for the same underlying user

  • the alternative (just ignoring the value) would mean

that an extra database read might be needed. This is
only used for users created with a row that includes
the user id - we silently discard the value if
the row doesn't have a user id (or the user id is 0)
to avoid issues with UserEditTracker trying to fetch
the user id and potentially triggering another load.

A follow-up will simplify the UserEditCountUpdate class
to remove storing full UserIdentity objects now that
only the id is needed.

Follow-up: Ibf1482bcbcbf4d56fc06531bb3e17e2a6e3e2e6f
Change-Id: Ie3fb4887d9f2d96b32598865030351bf3bf20ce5

Details

Provenance
DannyS712Authored on Jun 15 2021, 8:08 AM
Parents
rMW52cc0ce6baf9: Merge "DefaultPreferencesFactory: inject all services needed"
Branches
Unknown
Tags
Unknown
ChangeId
Ie3fb4887d9f2d96b32598865030351bf3bf20ce5