| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Found via disabling phan's alias support for a run (and ignoring wgLang's
hard-coded state of being a \Language, alas).
Change-Id: I4753bcd84d72d6de111fc7ffc5841fa417bf7333
|
|
|
|
|
| |
Bug: T353458
Change-Id: I3e829e35c93bcaae75e401b1801bddf93c0b416c
|
|
|
|
|
|
|
|
|
|
|
| |
DefaultOptionsLookup
* Moved getCacheKey to UserOptionsLookup
* Added caching to DefaultOptionsLookup after conditional options
* Move expensive getDefaultOptions to after cache miss
Bug: T386883
Change-Id: I307e1d30e84396b56d919993aef4d411ecae8ea1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GenderCache gets the "gender" user preference directly out of the
core database. Thus it does not respect global preferences. So:
* Add UserOptionsLookup::getOptionBatchForUserNames(), which gets a
single user preference for a set of named users.
* Add UserOptionsStore::fetchBatchForUserNames() as a backend. This is
a new interface method so is a breaking change.
* Have GenderCache call the new interface.
The no-database case in ServiceWiring is apparently no longer reachable
from the installer due to my previous patch which split
MediaWikiTitleCodec.
Performance generally degrades from one query to three. For change lists
and user page namespace redirects, it shouldn't be a problem, but for
the {{GENDER}} parser function there may be a user-visible performance
degradation.
Bug: T386584
Depends-On: Id02489a597f96cd1cd6db08e16b3624542fdf1f7
Change-Id: I9646b5422afce356e9a1dceeb09d8d4e286dc65e
|
|
|
|
|
|
|
|
|
| |
Provide an interface allowing extensions to add global preferences.
Add test for all the $global values.
Bug: T386592
Change-Id: Id982656e228efaa97068b90f5137a0495c86fae5
|
|
|
|
|
|
| |
And clean up related code and comments.
Change-Id: I3932725de5a732cbdab1c0a7db3ea26965d563fc
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
Use modern php syntax to call a callable.
Reduce the stack trace to improve performance
and better IDE and static analyzer support
Change-Id: I9ef131032a662a3b8db69aa7079dbd51f88f575a
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It is valid to use TS_MW for chronological compare as the timestamp
stored in a string is ordered from the most significant datetime
information (year) to the lowest (seconds).
It is not needed to convert to unix.
It would not be valid to use TS_MW format to calculate time differents.
This is how it is used in the database schema from mediawiki as well.
Bug: T378764
Change-Id: Ifc8dbc0a87d286fb63f200b1f255cb11cc70b1f3
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Same as Ia294bf4 did for 1-line comments. This patch removes slightly
more complex 2-line PHPDoc comments that don't add any new information
to the code, but literally repeat what the code already says.
They say "don't document the code, code the documentation", and we
are doing this more and more. We just tend to forget to remove the
obsolete comments.
Note I'm also removing a line of text in a few cases when it's very
short and literally says the same as the method name. Again, such
comments add zero new information.
Change-Id: I01535404bab458c6c47e48e5456403b7a64198ed
|
|/
|
|
|
|
|
|
|
|
|
|
| |
As part of T383701, I am planning to add a new hook to the service,
to allow extensions to modify ConditionalUserOptions. That hook
would be cubersome to call from ServiceWiring.
In order to maintain a single pattern, this patch refactors
the service to contain the call.
Bug: T383701
Change-Id: Idf5e84543f996a500a66c72b6bac97d188995de9
|
|
|
|
|
| |
Bug: T364652
Change-Id: I778a164d8eb2da9707ba4e3e1c7075bd627c0985
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* UserOptionsStore interface.
Follows-up If0b775d7ae (652d565584) for T323076, which introduced the
UserOptionsStore concept but it wasn't easy to figure out how an instance
is obtained, or how it relates to UserOptionsManager.
* User class.
Summarise the last 10 years of refactoring and decoupling, with
references to what we encourage new code to use instead.
Remove mention of MW 1.35 newable which is no longer applicable.
* Fix file headers and ingroup doc annotations
> Add missing `ingroup` to class blocks (and remove from file blocks)
> as otherwise the file is indexed twice (e.g. in Doxygen) which makes
> navigation on doc.wikimedia.org rather messy.
>
> Remove duplicate descriptions from file blocks in favour of class
> doc blocks. This reduces needless duplication and avoids incorrect
> or outdated copies emerging over time, and helps make file headers
> more consistently (visually) ignorable.
>
> Ref https://gerrit.wikimedia.org/r/q/message:ingroup+is:merged+owner:Krinkle+branch:master
Bug: T364652
Bug: T323076
Change-Id: I09fe4f64df88b5a83e7c934646467557f3af5fcd
|
|
|
|
|
|
|
| |
Two easy cases, way more can be done.
Bug: T376565
Change-Id: I3b875c4b6b2c2bdf7171a712898d50e26d86c807
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Why:
To facilitate the evaluation of conditions not directly
"known" by the lookup, eg: owned by extensions
What:
- Add ConditionalDefaultOptionsAddCondition hook which
runs before instantiating ConditionalDefaultsLookup allowing
to add conditions for evaluation in the $extraConditions
array.
- Evaluate the configured conditional default against the
extra added conditions after evaluation of "known"
conditions.
Bug: T376918
Change-Id: Ife6f96397eafd61fdb40528aac315ddde1ef2774
|
|
|
|
|
| |
Bug: T353458
Change-Id: I23cf7991f8792d4d000d1780463d8ce76dc0aee0
|
|
|
|
|
| |
Bug: T371340
Change-Id: I5eba0fa558ad7f111988c17cfcee260c5a272baf
|
|
|
|
|
|
|
|
| |
This touches various production classes and maintenance scripts.
The code should do the exact same as before. The main benefit is that
the syntax avoids any repetition.
Change-Id: I5c552125469f4d7fb5b0fe494d198951b05eb35f
|
|
|
|
|
| |
Bug: T353458
Change-Id: Id3202c0c4f4a2043bf97b7caee081acab684155c
|
|
|
|
|
| |
Bug: T353458
Change-Id: Ifa3b6a6e0353bb4ce21a3f4456f1fc696c8d377c
|
|\ |
|
| |
| |
| |
| |
| | |
Bug: T363059
Change-Id: I728cacf6acfc02ecb0ef9b3695e7770c2d3f8d83
|
| |
| |
| |
| |
| | |
Bug: T368595
Change-Id: I7b14cff095fe0f1eb9ff53762878f5801605ed6e
|
|/
|
|
|
|
|
|
| |
Versions are changed in 8e940c4f214ff7d17b53f51c6a46a5cf7fc2c92e,
but that makes the version wrong
Follow-Up: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
Change-Id: Iae43725b8e0fffc4d44bf57f6227334b41290bd9
|
|
|
|
|
|
|
|
|
| |
Add a "global" parameter to ApiOptions which allows it to update or
override global preferences.
Bug: T323076
Depends-On: I686c0091768ed330683fff89201fae4f93b8a1c4
Change-Id: Ieb2d0c0d0da5c51b2a47ed8a967a47b4e7ad4577
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Refactoring:
* Break out the database access part of UserOptionsManager to a separate
class hierarchy implementing interface UserOptionsStore. It's
basically a key/key/string-value store, very simple. The complex
parts of user options storage remain in UserOptionsManager.
* Bundle the UserOptionsManager caches into a per-user cache object. I
was adding a couple more and it was getting tedious.
Start integrating GlobalPreferences with UserOptionsManager:
* Have an array of stores. There's always a local store, and extensions
can add stores via an attribute.
* Add $global parameter to UserOptionsManager::setOption(), allowing
this method to update or override global options.
* Rename loadOptionsFromDb to loadOptionsFromStore.
* Move the local override feature from GlobalPreferences to core.
Bug: T323076
Change-Id: Ib3623b723557c819bc0ffdf21a4ffcb070eb298b
|
|
|
|
|
|
|
|
|
|
|
|
| |
I can't find anything in codesearch that uses this parameter. The
behaviour is odd and won't work for anything except a test. The other
parameters to User::createNew(), such as "email", will be written to the
database as initial values for the new user, which seems sensible. But
this "options" parameter just sets up fake options "prefetched" from
the DB, but doesn't actually insert them.
Bug: T323076
Change-Id: Icef65cb9f354197bc6dbcc92a3cf4d4e2918f2e8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix the dependency loop between PreferencesFactory and
UserOptionsManager by moving the concept of "reset kinds" or "option
kinds" to PreferencesFactory.
Note that this is a half-baked feature from 2013 (I5f9ba5b0dfe7c2ea)
that is not really used for anything. Apparently only the "all" and
"unused" kinds are used.
The strong dependencies on PreferencesFactory internal details show that
this feature belongs in PreferencesFactory. But UserOptionsManager can
reset "all" preferences without help from PreferencesFactory, so add a
helper for that.
The rationale for putting it in UserOptionsManager was that eventually
all preference definition information should move to UserOptionsManager
(T250822). I don't agree with that. UserOptionsManager is the key/value
store which backs PreferencesFactory. I need to refactor it further for
T323076 and it will help to have these concepts be separate.
Hard-deprecate UserOptionsManager methods resetOptions, listOptionKinds
and getOptionKinds. Add convenience methods to replace calls to
resetOptions().
I couldn't understand the logic in resetOptions(). Why was it copying
old values instead of just omitting them? Why was it assigning null but
only for "all"? setOption() had a documented method for resetting an
option to the default, so I just used that.
Bug: T323076
Depends-On: I1ed0a1a9f6492fb50254104fa4bc9f2130218323
Change-Id: I900fd4a48c96d91491eae54824e7bf02a004843d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds two new conditional user option default conditions CUDCOND_ANON and
CUDCOND_NAMED, for the purpose of allowing the specification of a
separate default user option for logged-out users. We're taking two
different approaches to the targeting of logged-out users (anon vs
named) because of the temporary users project - anon will not include
temporary users while named will allow us to target only fully created
user accounts. This will be ultimately be used for the rollout of the
reading accessibility settings menu
Bug: T360098
Change-Id: I316d231330159770f05234dd2f5fdb7d07531002
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an alternate for the workaround in I5987c4f1c3 (c98aeff078).
The service class should not need awareness of MW_PHPUNIT_TEST, or
otherwise have a mixed kind-of-yes/kind-of-not DB dependency.
With this patch, DefaultOptionsLookup is reverted to remove the
test-specific workaround in favour of using StaticUserOptionsLookup
in MediaWikiServices::disableStorage.
This is already called by MediaWikiIntegrationTestCase for tests
that don't enable the database.
Bug: T155147
Depends-On: I906450a4ac2dc51cdc536fbc978661b06f62f0a4
Change-Id: I8720d32fcfb18f7468e2c4b82412fe8664e28ddc
|
|
|
|
| |
Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is inconsistent with the access pattern of other constants in
MediaWiki. it's also confusing (e.g. it's unclear to a newcomer why
UserFactory is implementing IDBAccessObject) and it's prone to clashes
(e.g. BagOStuff class has a clashing constant).
It has been already announced: https://w.wiki/9DAX
Bug: T354194
Change-Id: Ic2357634b8385d65b55db2b557191419b06c40e0
|
|
|
|
|
| |
Bug: T353458
Change-Id: I09e66c3223018ec47e0549ee7f6a590b676f4eef
|
|
|
|
|
| |
Bug: T353458
Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
|
|
|
|
|
|
|
|
|
|
| |
Found via (?<!IDBAccessObject)::READ_
We are planning to deprecate and remove implementing IDBAccessObject
interface just to use the constants.
Bug: T354194
Change-Id: I89d442fa493b8e5332ce118e5bf13f13b8dd3477
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
And general clean up of db connection handling in core
Bug: T354194
Change-Id: Icb3685f1d7f8d1f4bcadf8e292ddf9450180fcdb
|
| |
| |
| |
| |
| |
| |
| | |
Within Ib145efbd337b7f09eed86d2873228a1b503d02f3,
I accidentally left a g within the comment. Remove it.
Change-Id: I4499f5348ee795cde4e5aecd4ae82e88f0973b6a
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
User options saved to the database and retrieved get converted
to strings, but defaults and set but not yet saved vaues don't.
This behavior can be confusing.
When a value equal to the default is set for a given user, that
value won't be written to the database; defaults are represented
by the lack of a database row. This behavior can also be
confusing.
Update the phpdoc of some user preferences related methods and
variables to make these things clearer.
Change-Id: I32a18b30f007c97015e6d641379ce60ab6ac7ed7
|
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously, UserOptionsManager:.isValueEqual considered null to be
equal to certain non-null values (such as an empty string). This
resulted in UserOptionsManager::saveOptionsInternal ignoring
any attempts to set any option to an empty string when
there was no pre-existing user_properties row.
Bug: T355086
Change-Id: Ib145efbd337b7f09eed86d2873228a1b503d02f3
|
| |
| |
| |
| |
| |
| |
| | |
This can slowly simplify and clean up this class.
Bug: T354194
Change-Id: I925544ec3107334d40afa42da37be930c25358a8
|
|/
|
|
|
|
|
|
|
|
|
|
| |
Instead of calling self::READ_* on these constants, just directly call
it.
Since these classes are public and might be relied on directly in other
places, we can't remove the "implements IDBAccessObject" yet but we will
start doing that soon.
Bug: T354194
Change-Id: I3e26b9fc7f93efdfc55a1790a7cdfa5c0d562303
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Why:
Sometimes, it is necessary to have different behavior
for newly registered and existing users. For example,
this happens in the Echo or GrowthExperiments extensions.
As of now, this behavior is implemented by inserting
user_properties rows in onLocalUserCreated.
Over time, this results in a singificant amount of rows
inserted, which contributes to the user_properties table bloat,
which is already overly large (cf. T54777). This patch makes it
possible to remove such rows by supporting conditional defaults
for user properties.
What:
Add support for conditional defaults of user properties. This can be
configured via `ConditionalUserOptions` config option.
Bug: T321527
Change-Id: I1549c3137e66801c85e03e46427e27da333d68e2
|
|
|
|
|
| |
Bug: T354278
Change-Id: I467c819e6f49c9e5269fb82043d265ac159dba82
|
|
|
|
|
|
|
|
|
| |
This makes the code easier to read to avoid jumps and improves
encapsulation by not allowing the rest of the class having access to the
logic. Of course, if needed then some code can be refactored out again
but for now let's not do YAGNI.
Change-Id: Ic37524e386fc04fd67e33768417ff8425f85b0ca
|
|
|
|
|
|
|
|
| |
Follow-up to I9822eb1553870b876d0b8a927e4e86c27d83bd52,
I missed the Static class in that patch.
Bug: T352284
Change-Id: I42653491c19dde5de99e0661770e2c81df5d7e84
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are a couple of user options related classes already,
and the T321527 work on dynamic defaults is going to add
even more. Let's move them into a separate namespace
to make core a bit more organized.
Old name is kept as an alias for compatibility purposes.
Bug: T321527
Bug: T352284
Change-Id: I9822eb1553870b876d0b8a927e4e86c27d83bd52
|
|
|
|
|
|
|
|
| |
This allows hook callers to compare before and after the save
Bug: T287397
Depends-On: I20098ae076b282296670d1116e14bbd29ea76b11
Change-Id: I4d09008bc2bc10afc3742b74564e5ef90ecfe5bf
|