Commit graph

1145 commits

Author SHA1 Message Date
Sam Smith
16cea35d85 Configure logged in session length independently
* Add the $wgExtendedLoginCookies configuration variable, which defines
  the set of login cookies that can have their lifetime configured
  independently
* Add the $wgExtendedLoginCookieExpiration configuration variable, which
  dictates when the extended lifetime login cookies expire
* Default $wgExtendedLoginCookieExpiration to null so that the current
  behaviour is unaffected

Bug: T68699
Change-Id: I0cc24524e4d7d9d1d21c9fa8a28c7c76b677b96c
2015-06-23 19:31:20 -04:00
Aaron Schulz
dd42294d29 Made User generally use DB_SLAVE by default
* By default, users will load from the slave unless
  the thread did a recent DB write. This is to handle
  changes within a request.
* ChronologyProtector should avoid staleness in common
  cases, and the CAS check on user_touched is a final
  barrier to block stale user object updates.
* Note that passwords are not cached, so they hit the
  DB when ever needed. Passwords now load from slaves
  when possible, instead of the master.
* This should get the code closer to handling user
  login and logged in users when the master is down.
* Fixed loadFromId() when READ_LOCKING is used.
* Also addressed TODO comment in load().

Bug: T92357
Change-Id: I0a8bdab720c19fe3fc2381799ae2e90ff09bb4cf
2015-06-16 08:29:06 -07:00
jenkins-bot
9ce9ca079f Merge "Password validity by policy per group" 2015-06-10 17:46:20 +00:00
csteipp
1a20dc9362 Password validity by policy per group
Make password policies defined in a configurable policy, which is
defined by group. A user's password policy will be the maximum of
each group policy that the user belongs to.

Bug: T94774
Change-Id: Iad8e49ffcffed38df6293db0ef31a227d3962003
2015-06-10 10:34:17 -07:00
Aaron Schulz
fd5bde60ec Fixed "wfTimestamp() fed bogus time value" errors
* This broke OutputPage::checkLastModified() as the touched time was false

Change-Id: I118d3ddf07c7b69ad269f3aee0c70ab4159df192
2015-06-09 18:47:49 -07:00
jenkins-bot
6378a12c88 Merge "Made User::touch no longer call load()" 2015-06-03 07:47:00 +00:00
Aaron Schulz
5399fba68b Use less fuzzy User::getDBTouched() in ApiStashEdit::getStashKey()
* The getTouched() value can bump more often or vary in DCs

Change-Id: Idffa22c9dde7c7950943b104ed61f5779636b7e7
2015-06-02 20:31:14 +00:00
Aaron Schulz
833bdbab37 Fixed $flags bit operation precedence fail in User::loadFromDatabase()
* The bug made READ_LATEST also act as READ_LOCKING

Bug: T100577
Bug: T100869
Bug: T98706
Change-Id: I85092970c236fc4482371216b9f6592c49a27942
2015-06-02 18:39:37 +00:00
Aaron Schulz
5b2670b31b Made User::touch no longer call load()
* Just reset mQuickTouched instead of guessing a new value
  in touch() for simplicity

Change-Id: Ibfe551cf061919ab18c4ff634d8db8f3c0eaf0a5
2015-06-02 17:24:48 +00:00
Ori Livneh
05aac977eb User::clearSharedCache: don't load the full user record for just the ID
Rather than call $this->load() unconditionally, get just the ID via
$this->getId(), potentially saving us a database lookup.

Change-Id: Ifa3b96956a1d66d3e877573ff01970758fad8790
2015-05-19 15:45:46 -07:00
jenkins-bot
d1150378f1 Merge "Converted User object cache to the WAN cache" 2015-05-18 06:38:06 +00:00
jenkins-bot
fe5c31a59b Merge "Converted User touched key to using the WAN cache" 2015-05-11 16:52:48 +00:00
jenkins-bot
d892c0f86f Merge "Made wl_notificationtimestamp updates able to use queues" 2015-05-04 18:35:45 +00:00
Aaron Schulz
b614290f73 Converted User object cache to the WAN cache
Bug: T93141
Change-Id: I93dc5367d85d661bd5bdce29f4665bb8cd21ba02
2015-04-30 01:30:06 +00:00
Aaron Schulz
4a8da41079 Converted User touched key to using the WAN cache
Bug: T93141
Change-Id: Id5478d3007bde3f621b4c3ffe9950a654e0ac30a
2015-04-30 01:30:00 +00:00
Aaron Schulz
76f961097a Remove cache use in setNewtalk, as nothing reads from that
Change-Id: Ia094fa99be49816b48e35aeb695b5d9558fd1d28
2015-04-27 16:45:58 -07:00
Aaron Schulz
836ad263c3 Made wl_notificationtimestamp updates able to use queues
* This adds a wgActivityUpdatesUseJobQueue setting, which lets
  these updates work via the job queue, rather than direct DB
  master updates.

Bug: T91284
Change-Id: Ie60e20162fd833e64d81763a6aa1dc3faf2162f3
2015-04-25 14:47:42 -07:00
jenkins-bot
786a37c577 Merge "Added CAS logic to User::addAutopromoteOnceGroups" 2015-04-21 15:43:54 +00:00
Aaron Schulz
8c5406a437 Added CAS logic to User::addAutopromoteOnceGroups
* This should avoid duplicate logging events on races or when
  the cache fails to update.
* Also added getDBTouched() method to get user_touched itself.

Bug: T48834
Change-Id: Ib2cd0a2c72629fa4e13dcff4d2d6fbac8e690b32
2015-04-16 13:31:40 -07:00
Aaron Schulz
28404fad36 Made saveSettings() CAS check handle caught DB exceptions better
Change-Id: I8e9e75af437e00a76e4184908c579a6702c9023a
2015-04-16 10:54:45 -07:00
Aaron Schulz
9e50d6e999 Try to reduce stale cache updates in User::saveSettings()
Bug: T95839
Change-Id: I4dc87697448b833ea575cbb3e05c92c7160d03f9
2015-04-15 20:34:51 -07:00
Aaron Schulz
eccd9707a8 Tweaked CAS log message for User::saveSettings
Change-Id: I82376561b3c7c15da6fe6374db0245caa5d79ce8
2015-04-15 17:58:48 -07:00
This, that and the other
ae3ab9eef0 Allow users to add, remove and apply change tags using the API
You can add tags at the same time as performing action=edit, as long as you
have the "applychangetags" right. Also, you can add or remove tags after
the fact from revisions and log entries using the API action=tags.

No UI is provided for either of these changes. The target audience is user
scripts, gadgets and similar tools.

Includes a new log parameter format type: "list", for a comma-separated
list of values.

Logging of change tag events is limited to those that do not accompany an
edit (i.e. those done after the fact), and is hidden from Special:Log by
default, similar to the patrol log.

Bug: T20670
Change-Id: I37275e0f73fa3127f55da0c320b892551b61ee80
2015-04-15 18:30:45 +00:00
Aaron Schulz
7eb982b0b4 Avoid deadlocks in User::incEditCount
* This makes concurrent editing less problematic

Change-Id: I930222d5e831bb3729194abbdcb3cab194c70494
2015-04-14 04:59:44 +00:00
Aaron Schulz
5b4bd16327 Made User::invalidateCache() use touch() instead of the DB query
* This method is used for clearing the User cache as well
  as bumping the value of getTouched() for HTTP 304 logic.
  These do not need to do the actual user_touched update.
* This also avoids problems with setting mTouched but
  deferring the update. That confused the CAS update
  logic since it expects mTouched to be in the DB.

Change-Id: I96b30f5c9c8b4714e6663b187f741954a13312cf
2015-04-07 19:59:35 -07:00
Aaron Schulz
eb9a75cff6 Made User::loadPasswords respect "queryFlagsUsed"
* Also cleaned up a few var names

Change-Id: I3a835e3980dfc3205716cf5bb1a4c04aa037f36d
2015-04-07 12:12:23 -07:00
jenkins-bot
7253056a23 Merge "Added CAS-style logic to User::saveSettings as a final sanity check" 2015-04-07 15:43:43 +00:00
jenkins-bot
4b983308cb Merge "Log when User::saveSettings is called in read-only mode" 2015-04-07 09:44:59 +00:00
Aaron Schulz
f6b76d3a9e Added CAS-style logic to User::saveSettings as a final sanity check
* This should prevent lag or race conditions from rolling back data

Change-Id: I5e70975f4e4010fea7af0801bc11dda887df55f4
2015-04-06 12:20:05 -07:00
Aaron Schulz
6af07cbe1f Log when User::saveSettings is called in read-only mode
Change-Id: I56a1760f2e6bbda889590777b553a8dfda587590
2015-04-06 11:26:42 -07:00
Aaron Schulz
b84d573d4b Made User::newTouchedTimestamp handle clock skew a bit better
* This does not handle race conditions, but is a prelude to using CAS
  style logic on save using the timestamp.

Change-Id: I9c31c272fcf77b686764b7c3a6a32ac29576347c
2015-04-06 11:14:48 -07:00
Aaron Schulz
f7fe3c2b46 Added read-only checks around User::saveSettings where they belong
* Ideally saveSettings() would not just silently do nothing in
  read-only mode as not all callers expect that behavior. This
  change is just the first step.

Change-Id: Ieeaf531dac3027ddba89c60159b98f9c04de78d3
2015-04-02 18:12:37 +00:00
Tyler Romeo
63cf33d825 SECURITY: Set maximal password length for DoS
Prevent DoS attacks caused by the amount of time
it takes to hash long passwords by setting a limit
on password length.

Slightly restructures the behavior of User::checkPasswordValidity
in order to accommodate for the difference between
passwords the user should be able to log in with and
passwords they should not.

Bug: T64685
Change-Id: I24f33474c6f934fb8d94bb054dc23093abfebd5e
2015-04-01 09:55:42 -07:00
jenkins-bot
eca8322266 Merge "Removed unused parameter from User::checkNewtalk" 2015-03-30 18:31:55 +00:00
Aaron Schulz
4f8dc27b90 Removed unused parameter from User::checkNewtalk
Change-Id: I112fc32d9985664ab5edea842f52f62554c082ea
2015-03-30 11:15:01 -07:00
Aaron Schulz
ab24e5d417 Made User::getFormerGroups load properly
Change-Id: I5c752f9446ef78f08c457e9758ebf9e0b79a0c37
2015-03-30 11:13:46 -07:00
Aaron Schulz
cdc572c767 Made User::validateCache account for mQuickTouched
Change-Id: I3b733a0221462350f3a24d54ffe814357f379512
2015-03-30 09:36:49 -07:00
jenkins-bot
f9a5c17799 Merge "Made user preferences load from the master by default" 2015-03-30 15:30:49 +00:00
Aaron Schulz
f68da5b863 Made User actually use the mQuickTouched process cache
Change-Id: I158eae2dac16b5fdacd095fff7fb031b42804a1e
2015-03-26 22:51:13 -07:00
Aaron Schulz
7e27652a76 Made user preferences load from the master by default
* Warn when saving slave-loaded data in saveSettings()
* Respect the loading $flags for preferences/groups
* Fixed use of flags in addToDatabase()
* Made loadFromCache() protected to make this mess easier
  to reason about (no callers found)
* Added some doc comments

Bug: T92232
Change-Id: Ic1dd66063cc2f98fc03861df1c523981f846a0be
2015-03-26 19:18:44 -07:00
jenkins-bot
ddfcbf86cc Merge "Made addAutopromoteOnceGroups check wfReadOnly" 2015-03-26 22:37:59 +00:00
jenkins-bot
1be2b846dd Merge "Introduced User::touch() method to bump the getTouched() value using memcached" 2015-03-26 22:25:19 +00:00
Aaron Schulz
04424ff049 Made addAutopromoteOnceGroups check wfReadOnly
Change-Id: I2fecf6616dd00cd34647f67298583ea8ec2977c0
2015-03-26 15:20:14 -07:00
Aaron Schulz
87d2eba431 Introduced User::touch() method to bump the getTouched() value using memcached
* This lets some callers avoid the heavyweight invalidateCache() method

Bug: T91279
Bug: T92357
Change-Id: I8c1c7ff9c5574f0eca23e7effde199ab13a19231
2015-03-26 15:05:56 -07:00
Aaron Schulz
70919c8a32 Made User::loadFromRow protected for sanity
* The loading logic is complex enough without more possible
  entry points to cover
* No outside callers found

Change-Id: I7e9bace35afb0a540993423cf1da98381a516ac5
2015-03-26 05:41:42 +00:00
Aaron Schulz
14f63add18 Allow callers to load user objects from slaves if desired
Bug: T92357
Change-Id: Ib9d21b8ee988c84e7b3d1676ad6cbbbf07f795a4
2015-03-24 10:38:05 -07:00
jenkins-bot
b15cd2ee45 Merge "Re-introduce AvailableRightsTest for User::getAllRights completeness" 2015-03-16 18:00:02 +00:00
Aaron Schulz
58c8e2b969 Made getNewtalk use slaves instead of cache/master
* This was causing floods of master connections on page views

Bug: T92357
Change-Id: I02fd1505f589112b8f6217047e6713845142a1c3
2015-03-13 21:46:28 +00:00
Amir E. Aharoni
16c2aec980 Shorten long lines in User.php to make phpcs pass
Change-Id: Id0938687439d046b98d7b3a4b7666ff7ae41760a
2015-03-04 04:26:32 +00:00
Kunal Mehta
c899d19888 Populate User::$idCacheByName in User::loadFromRow() if possible
Change-Id: I4c7dab517ca6b7adcdec0c945e21d6be0b7b7d66
2015-03-02 14:52:25 -08:00