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
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
This commit replaces some of the uses of getErrorsArray(),
getWarningsArray(), getErrorsByType(), and getErrors().
In many cases the code becomes shorter and clearer.
Follow-up to Ibc4ce11594cf36ce7b2495d2636ee080d3443b04.
Change-Id: Id0ebeac26ae62231edb48458dbd2e13ddcbd0a9e
This patch introduces a namespace declaration for the
MediaWiki\Watchlist to WatchedItemQueryService and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: Ib1b5c19c89087940987730939e84c8cd35cd3760
This patch introduces a namespace declaration for the
MediaWiki\Content to CssContent and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I6ab25787893cb2195f8cd2ba125ed8dd5a60de43
This patch introduces a namespace declaration for the
MediaWiki\Content to JavaScriptContent and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I87c17327911e28a461feaf2ff46242454cff257a
This patch introduces a namespace declaration for the
MediaWiki\Json to FormatJson and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I5e1311e4eb7a878a7db319b725ae262f40671c32
* Deprecate and stop using $wgBlockTargetMigrationStage. Remove
block_target migration code.
* Make the $schema parameters to DatabaseBlockStore methods default to
SCHEMA_BLOCK. Avoid passing these parameters where possible.
* Remove cleanupBlocks.php
* Deprecate DatabaseBlock static methods which try to present the old
schema for b/c.
Bug: T362133
Change-Id: I845bad8cc09a4528fef46a6f9d490ebdec881d99
Legacy parser can now output headings using a more accessible markup,
which is also identical to the markup used by the Parsoid parser.
Changes to client-side JS and CSS necessary to support the new markup
have already been merged in earlier commits.
includes/skins/Skin.php
includes/ServiceWiring.php
* Define a new skin option, 'supportsMwHeading', which can be used
to toggle the new markup per-skin.
* Update the built-in fallback skin to enable it. This affects the
output in parser tests.
docs/config-schema.yaml
includes/config-schema.php
includes/config-vars.php
includes/MainConfigNames.php
includes/MainConfigSchema.php
* Add a new configuration setting, 'ParserEnableLegacyHeadingDOM',
which can be used to toggle the new markup per-site.
includes/OutputTransform/Stages/HandleSectionLinks.php
* Output new heading HTML for skins that enabled the option.
tests/*
* Duplicate parser tests that cover heading generation to cover both
new and old markup. Update other parser tests to use new markup.
* Add some unit and integration tests for the behavior of the skin
option and some parser tests for edge cases of the new markup.
Bug: T13555
Change-Id: I1180169a8e83af834c2984ba16089e6277f2a8dd