Extensions can use the ArticleParserOptions hook to customize the
parser options used for article read views, and Visual Editor uses
ApiParse to regenerate the article read view HTML after edit. In
order for VE to remain consistent with the original parse options,
provide a `usearticle` option to the parse API to allow it to invoke
the ArticleParserOptions hook.
Bug: T373212
Change-Id: I906affc8d2335b7bb48dff3a4b061fcf86b71cee
The main benefit is that this syntax avoids repeating the variable
name. It does the same as before.
Change-Id: I2040be889c749f4e2416ca9948ba261345858af2
It is difficult to distinguish this method from OutputPage::addJsConfigVars()
in code search:
https://codesearch.wmcloud.org/search/?q=%5BOo%5Dut%28put%29%3F%28%5C%28%5C%29%29%3F-%3EaddJsConfigVars%5C%28
We generally try to replace $output with $parserOutput or $pOutput
as we touch code, to improve the ability of codesearch to dig up
deprecated ParserOutput methods.
A future project will unify those parts of OutputPage which duplicate
ParserOutput: T301020.
Bug: T300307
Bug: T305161
Depends-On: I39ae7d7a40190eedaa024097a6442cd02b6a02e7
Depends-On: I2c660972b289bbad730ceee1325d70d5ba75d27e
Change-Id: I53c28ee7c80b889c893c1d00f37678e716e55783
get_debug_type() does the same thing but better (spelling type names
in the same way as in type declarations, and including names of
object classes and resource types). It was added in PHP 8, but the
symfony/polyfill-php80 package provides it while we still support 7.4.
Also remove uses of get_class() and get_resource_type() where the new
method already provides the same information.
For reference:
https://www.php.net/manual/en/function.get-debug-type.phphttps://www.php.net/manual/en/function.gettype.php
To keep this safe and simple to review, I'm only changing cases where
the type is immediately used in an exception message.
Change-Id: I325efcddcb58be63b1592b9c20ac0845393c15e2
Edits from temporary accounts are considered anonymous edits.
ApiQueryRecentChanges doesn't correctly reflect this and needs to be
updated to correctly return temporary account edits as anonymous (and
similarly, not to return them when requesting !anon)
- Update the anon|!anon query to accomodate temporary accounts
Bug: T370803
Change-Id: Ica5225422ea53d2aa3a84b86d9c2f14832a34ed4
In change I625a48a6ecd3fad5c2ed76b23343a0fef91e1b83 I am planning to
make Wikimedia\Message\MessageValue use it, and we try to pretend that
it is a library separate from MediaWiki, so it makes sense to move
MessageSpecifier to the same namespace under Wikimedia\.
Bug: T353458
Change-Id: I9ff4ff7beb098b60c92f564591937c7d789c6684
This method has become unnecessary after we introduced interfaces that
return StatusValue objects directly instead of legacy error arrays.
Depends-On: I2311d1fa3772ba6be378ad6f497ed4c0df9b7aa8
Depends-On: I3af555c31320d8e9b1362dfc8bf0d8315539ba4f
Depends-On: I1d9e1c94b814b22a7691b710ed033526cc823032
Change-Id: Ifa67cf4e05a318539f6254a631de14156c41d462
And deprecated aliases for the the no namespaced classes.
ReplicatedBagOStuff that already is deprecated isn't moved.
Bug: T353458
Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
Why:
- The test checks for anon edit functionality specifically
What:
- Disable temp user feature for this test
Bug: T365669
Change-Id: I856ff3cb5ed64fd2d46a7cffc5084415f66ee536
Why:
- Anon authority will generate manual log entries with an anonymous
actor, which won't work with temp accounts enabled
What:
- Set the context user to a regular account before calling
::setVisibility on a list from RevisionDeleter
Bug: T365669
Change-Id: I3a813c69abcc715eec5048acc316d1fb43242b01
Why:
- The test class does anonymous edits, but did not first disable temp
user creation
What:
- Disable temp user creation before attempting an anonymous edit
- Enable temp account feature when calling doTempPageEdit
- Remove call to enableAutoCreateTempUser in testShowAnonParamsTemp, as
it's no longer needed
Bug: T365669
Change-Id: I2ce83d5703ecc75fe680d7ddb44aa406c26c4df5
Why:
- This test does not pass when temp accounts are enabled
What:
- Set disableAutoCreateTempUser when doing an anon page edit
- Set a valid pattern for the temp user name
This patch does not fix testUserPropParameter but does solve the other
failures for this class.
Bug: T365669
Change-Id: I24b3ff10c6275a9c13c3f07d97ea14581f975067
Why:
- This test exercises code that checks for IP edits
What:
- Disable temp user feature for this test class
Bug: T365669
Change-Id: If385b71b76c16f9276c3973a02ca0c888b47d3a3
Why:
- Anon authority will generate manual log entries with an anonymous
actor, which won't work with temp accounts enabled
What:
- Switch test cases to use registered authority mock
Bug: T365669
Change-Id: I4d3a79506d2f1fc744fc32b75e560f084738bdd7
Why:
- In some situations (e.g. tests in ApiRevisionDeleteTest),
the context user ID / name was being unset by code in Session
What:
- Set the session user to the request context user
Bug: T365669
Change-Id: Ife2cc31133bafb6a2c0adfeebcb2e1a139f25f48
Why:
- When temp accounts are enabled, creation of new log entries needs to
be associated with a named user account or temp account
What:
- Set the context user to a regular account before calling
::setVisibility on a list from RevisionDeleter
Bug: T365669
Change-Id: I1be6924a92309ea5da75df37910949440e23c937
Some syntax highlighters, in particular Gerrit's, incorrectly handle
code that uses a property named 'interface' (which is a PHP keyword).
https://phabricator.wikimedia.org/F55884039
Rename it to avoid problems.
Message isn't '@stable to extend', so this is not a breaking change.
I couldn't find any extensions that refer to it anyway.
Change-Id: I6676421222921b7bb1aeeefef79dd06072c1c2ac
For a deduplication the raw sql is used as string key in an array.
Now only the search term is part of the key, build the sql a bit later,
as objects not usable in array keys.
The deduplication is needed when namespaces have different first letter
configs as happen with $wgCapitalLinks = false for all namespaces except
the hard coded like user and mediawiki with talk.
Searching for lower case titles splits the query
Bug: T361023
Change-Id: Ia4e29d1d4d816f354318ef443ae19c954fd52274
Why:
- Using TempUserConfig is more flexible as it doesn't require us to know
about the internal details of the AutoCreateTempUser config object
What:
- Use TempUserConfig service instead of loading the AutoCreateTempUser
object
- Remove properties from ApiQuerySiteInfo that don't already have
getters. If someone has a need for more this information to be exposed
in ApiQuerySiteInfo, they can be added in a separate patch
- This seems compatible with the goals of T335532 which was about
making it possible to discover via the API if an action would result
in a temp account
- Implement __toString for Pattern, so that it can be used in
ApiQuerySiteInfo
Bug: T335532
Change-Id: Ica84b3e9b9865b8b83a9e9e513c99cd2e47661c9
Why:
- Consistency with the enableAutoCreateTempUser method
- Allows for overriding config properties (e.g. 'known')
What:
- Use an array as the parameter for `disableAutoCreateTempUser` instead
of a string
Change-Id: I1a495cc83effcf92364fa489f779c5f4bf2d29b9
Modifies incrStatsByContent in order to migrate cache_misses, cache_hits to Prometheus backend
Bug: T359465
Change-Id: I78afac7437bc2849b64f43c23477d702b94e907b
Add a "global" parameter to ApiOptions which allows it to update or
override global preferences.
Bug: T323076
Depends-On: I686c0091768ed330683fff89201fae4f93b8a1c4
Change-Id: Ieb2d0c0d0da5c51b2a47ed8a967a47b4e7ad4577
In PHP 8, but not in PHP 7.4, every class with a __toString() function
implicitly implements the Stringable interface. Therefore, the
behavior of checks like "instanceof Stringable" differs between these
PHP versions when such classes are involved. Make every such class
implement the interface so that the behavior will be consistent.
The PHP 7.4 fallback for the Stringable interface is provided by
symfony/polyfill-php80.
Change-Id: I3f0330c2555c7d3bf99b654ed3c0b0303e257ea1
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