Commit graph

14562 commits

Author SHA1 Message Date
jenkins-bot
d018c4f6ed Merge "rdbms: Add more return typehints" 2021-09-14 20:51:25 +00:00
jenkins-bot
a7e6a04334 Merge "Remove Title from signatures in CategoryViewer" 2021-09-14 19:04:18 +00:00
DannyS712
722ae6c6e1 Make UserDefTest a unit test
Building on my last few changes to use UserIdentityLookup and
TitleParser, plus the recent addition of UserNameUtils to the
DummyServicesTrait, its now fairly simple to make this a unit
test and retrieve services from DummyServicesTrait instead of
MediaWikiServices.

Add a 'hookContainer' option to
DummyServicesTrait::getDummyUserNameUtils(), because
subclasses of TypeDefTestCase don't have a helper method
createHookContainer() (normally this is provided by
MediaWikiTestCaseTrait). Instead, create a manual mock
HookContainer, like we did previously at NamespaceDefTest.

Also add more options to DummyServicesTrait to allow
callers to provide service instances, needed to avoid
creating two MediaWikiTitleCodec objects and to use
a hook container in NamespaceInfo.

This also required replacing uses of createNoOpMock()
in DummyServicesTrait, because that is also not available
in UserDefTest (its another feature of MediaWikiTestCaseTrait).
It may be worth exploring splitting MediaWikiTestCaseTrait into
the parts that are specific to MediaWiki (like HookContainer
or the Message system) and parts that are useful generally
(like createNoOpMock).

Change-Id: I25b8f0256d222d994173eee66f379fb5422994b5
2021-09-13 23:55:51 -04:00
DannyS712
5da80e9abf UserDef: creating from id 0 should be unknown user, not context ip
The User class sets the name to be the context ip when creating based
on id 0, and the switch to UserIdentity(Value) matched that behavior,
but its likely unexpected for callers - treat 0 the same as other
ids that don't correspond to existing users by returning a
UserIdentityValue with an id 0 and the name "Unknown user".

Bug: T288311
Change-Id: I9763e4c1e17de8930e0f982ea868405db20a8efd
2021-09-14 03:25:40 +00:00
DannyS712
46ef24f70a UserDef: use TitleParser instead of Title objects
Migrate away from the Title object, use
TitleParser::parseTitle() which returns a
TitleValue which is enough. Will be followed by
switching UserDefTest to a unit test, but in a separate
commit.

Change-Id: Ia756964861c4e0f3edea89f6beec2643243ca741
2021-09-14 03:25:36 +00:00
DannyS712
9308ee9cf8 UserDef: no need to return full User objects
Maintain the existing behavior for creating based on a user
id or name that does not correspond to an existing user:
* if creating a User object based on the id 0, User::loadFromId()
will load the defaults with the name being set to false, and
User::getName() will convert that false to the ip of the current
request. We probably don't want UserDef to be doing that, but
this behavior should be changed separately - at the moment
we are just matching the existing behavior (see the prior commit
which adds tests to confirm the behavior isn't changing)
* if creating a User object based on an id that cannot be found
in the database, User::loadFromDatabase() will load the same
defaults, *except* that it will set the user name to "Unknown user"
* if creating a User object based on a name, User::getId() will,
if the id isn't already known, return 0 if the name matches
UserNameUtils::isIP() or ExternalUserNames::isExternal(). However,
the User object is currently only created based on a name after
passing an ExternalUserNames check, and the creation with
RIGOR_VALID prevents it from being an ip. Thus, the existing
code will call User::load(), which will check the database or
fallback to 0 if the user does not exist.

When creating a User from an id that does not exist, User::getId()
will return that id, until after the object tries to fully load,
after which it'll return 0 for the id. Since we cannot replicate
this with UserIdentity (switching the id to 0 only after getName()
is called for the first time) we set the id to always be 0, which
is more accurate. This is the only change in behavior.

We will remove the use of the context ip in a follow-up that will
switch to using "Unknown user" instead.

Accordingly, we will use a UserIdentityLookup as well as
manual construction of UserIdentityValue objects to match this
behavior.

Bug: T288311
Change-Id: Ida80c5d04d721fafa8d66f656dbd346c6cf643eb
2021-09-14 03:25:31 +00:00
Volker E
565b14c234 resourceloader: Remove -moz- vendor prefix from SkinModule css
Our basic support has been updated and Firefox supports replacement
`resolution` since version 8 or 16, depending which data source
one checks.
WebKit's support is a bit more complex and it seems like safest bet is
to leave its vendor prefix in for now.

Bug: T277803
Change-Id: I752f0b67672759824099b4b78892d143344e766f
2021-09-14 00:22:00 +00:00
Aaron Schulz
c7b6548bc5 objectcache: improve the WANObjectCache "lag mitigation" TTL logic
Handle edge case of fast callbacks that happen to run just before
the transaction age reaches MAX_READ_LAG. Such callbacks will no
longer be considered "slow".

Distinguish slow and fast regenerations for the case when TTL
mitigation is triggered by the combination of snapshot and
replication lag.

Reduce the cases where TTL_UNCACHEABLE is used as the mitigation
TTL, to avoid operational risk.

Simplify the mitigation TTL code by reducing needless variation
between the "lockTSE" and non-"lockTSE" cases.

Track the key and time of the last 10 get() calls that returned
either a stale value or no value at all. Use this this estimate
the walltime in set(), if it was not provided.

Bug: T285070
Change-Id: Ie6c88fbf7dbfc831d67bfb6cde082c123555a8cf
2021-09-14 00:17:56 +00:00
jenkins-bot
a38aa20360 Merge "objectcache: Update WANObjectCache test to not require fraction in purge value" 2021-09-13 21:46:48 +00:00
jenkins-bot
80a054d35f Merge "Remove stub threshold feature" 2021-09-13 19:50:48 +00:00
James D. Forrester
f4eef180a0 MediaWikiIntegrationTestCase::getExistingTestPage: Don't assume NS0 is wikitext
Found in the WikiLambda extension following the landing of 2b24f6d20.

Change-Id: I19aa4c9833e3659325977beac7d790045da73df1
2021-09-13 09:48:55 -07:00
jenkins-bot
c4b17ee3bb Merge "Drop action api token methods deprecated in 1.24" 2021-09-13 16:47:49 +00:00
Petr Pchelko
5afc62f258 Remove stub threshold feature
Bug: T284917
Change-Id: I5c9ea04a9deca136bb7210f07200d18f97fd6686
2021-09-13 09:26:38 -07:00
Aryeh Gregor
ceda8ac60e Remove Title from signatures in CategoryViewer
Co-authored-by: Daniel Kinzler <dkinzler@wikimedia.org>
Change-Id: Ie880482fe58b96809fdfd08ebf0825bdcf1d19d1
2021-09-13 16:14:06 +00:00
jenkins-bot
170df4c511 Merge "Structure test for all content models" 2021-09-13 16:12:50 +00:00
Petr Pchelko
8d7201894c Drop action api token methods deprecated in 1.24
Removes deprecated API endpoints and modules for dealing with
CSRF tokens.

Note: i18n messages are removed in a followup for ease of revert.

Bug: T280806
Depends-On: Ic83f44587db119ff2e3e6d5ff33a10894e0695e7
Change-Id: I58aedec6942ac5d3c21574cb0072f00ef365098c
2021-09-13 15:22:16 +00:00
jenkins-bot
80b422f871 Merge "Fix indent of line comment" 2021-09-11 21:39:07 +00:00
Umherirrender
ce77d66ac6 Fix indent of line comment
Change-Id: Iff689d700a4891ffae647d0d9ee2d0d486a9eafe
2021-09-11 20:56:18 +02:00
Timo Tijhof
11ed63fe89 objectcache: Update WANObjectCache test to not require fraction in purge value
In prep for the next commit and to confirm that it passes
both before and after.

Change-Id: I4d203843a8cb2486584df1601fec589389110f73
2021-09-11 19:48:08 +01:00
Timo Tijhof
d87e085706 phpunit: Remove file_exists check from ReadOnlyModeTest
Per [[mw:CC/PHP]], use of file existence check is an anti-pattern
because it is subject to race conditions (e.g. parallel tests), and
needlessly slower than just performing the operation directly.

If code needs to do something in response to the file not existing,
then one can check the return value instead. This matches how other
we do it in tests and other production code.

Follows-up I3b2bac837c.

Change-Id: I4944bead2629e9d1e89cf53fa3e710a617f63726
2021-09-11 18:22:16 +00:00
jenkins-bot
2daa645833 Merge "resourceloader: Move tests for startup to startup subdirectory" 2021-09-10 23:41:33 +00:00
jenkins-bot
7dbc64e3d3 Merge "resourceloader: Clean up mw.Map tests" 2021-09-10 23:41:21 +00:00
Amir Sarabadani
64752c0fc4 Drop $wgDjvuToXML
The software behind this is abandoned and we are migrating djvu metadata
to json instead.

This doesn't affect production as we already use djvudump

Bug: T275268
Change-Id: If45ae5746ba91ba305f93603dc1e3aafba80a369
2021-09-10 23:40:31 +02:00
Timo Tijhof
9150dee4ee resourceloader: Move tests for startup to startup subdirectory
Change-Id: I9742d2e1518580c7043b649ff049c718c939b7d8
2021-09-10 21:34:09 +00:00
Timo Tijhof
b33dbb2aee resourceloader: Clean up mw.Map tests
* Move to separate file.
* Remove most of the verbose assert messages in favour of just
  a few words that label the asserted value or the call that it
  checks the value of. The actual/expected values are already in
  the UI, and the class/method are already in the formatted test
  name (which includes the module name).

Change-Id: I43ec038abd0946a92f222a859807e252696c33d4
2021-09-10 21:13:12 +00:00
Timo Tijhof
143a532b41 stats: Simplify normalizeMetricKey() and fix bad output for edge cases
This simplification effort is the result of a (failed) attempt to
micro-optimize this method. I submit it, despite it not being any
faster or slower, because I noticed that the simpler code actually
resulted in behaviours that I consider "less surprising".

* The method previously (I believe, unintentionally) treated all
  colons as segment separators. It now only treats double-colon (::)
  as segment separator.

  Thus "foo.bar:baz" became "foo.bar.baz", now "foo.bar_baz".

* Leading and trailing underscores are no longer removed from
  segments. This makes the former-presence of invalid characters
  more obvious to consumers and seems helpful.
  This also fixed two bugs:
  - In some cases, a segment could become the empty string, which is
    invalid for Graphite as each segment must be a directory name.
  - In some cases, segments could dissappear entirely, thus changing
    the hierarchy specified by the producer in ways they probably
    didn't expect.

* Avoid use of empty().

Change-Id: I8601faf1fe45124370a92d43e854608e623c1214
2021-09-10 19:39:30 +00:00
Timo Tijhof
1a558181b4 stats: Defer BufferingStatsdDataFactory::normalizeMetricKey to send phase
Avoid the time cost of normalizeMetricKey (and other effects of
produceStatsdData, such as holding on to StatsdData during the request),
by deferring it until we are about to send the data to the StatsD server.

As of this commit, the sending of data still happens pre-send which
means this change does not remove its delay from the HTTP response time.
But, it does have two other effects:

* It makes the cost of calling $stats->timing() and ->increment()
  much lower, which helps reduce the time attributed to calling
  `WANObjectCache->getWithSetCallback`.

* It prepares the code for moving this to post-send in a future patch.

* It moves the scattered cost to a centralised place in the flame graph.
  WMF's flame graphs are configued to crop the top of flames that are
  smaller than 1px. This is important for making the flame graphs render
  in a reasonable amount of time, but means that functions that have
  many unique paths to them hidden from view. Centralising this will
  make it easier to quantify how much time is spent here, which will
  be of use even after it becomes post-send, since we have flame graphs
  for post-send as well.

Also:

* Improve documentation.
* Add tests for normalizeMetricKey().

Bug: T288702
Change-Id: I1c57104590e48222b3e972589d49891b71afaee7
2021-09-10 19:39:20 +00:00
jenkins-bot
f16365e00e Merge "Revert "tests: suppress API prefix uniqueness check for 'pi'"" 2021-09-10 18:38:12 +00:00
jenkins-bot
5a53d57449 Merge "LinkCache: soft deprecate addGoodLinkObj()" 2021-09-10 17:22:02 +00:00
daniel
2b24f6d20e Structure test for all content models
This structure test makes sure that some basic operations work peroperly
for all registered content models.

The idea is to make sure we don't break anything for extensions when we
make changes to COntent and ContentHandler classes.

Bug: T287158
Depends-On: I739be0e8b03bf2c7f2589a106e2fae46f7bb160e
Change-Id: I2fc864a201b929fcf97c02296f7e3c831d5cbea4
2021-09-10 17:11:54 +02:00
jenkins-bot
7ece0e7afd Merge "Title: Make use of BacklinkCacheFactory service" 2021-09-10 14:31:23 +00:00
daniel
855988fd0e LinkCache: soft deprecate addGoodLinkObj()
addGoodLinkObj() has many optional arguments, but omitting them actually
means corrupting the cache.

Nearly all existing callers are in tests.
So LinkCacheTestTrait::addGoodLinkObject() was created only
for testing. It is better to have this method in the
trait, because building the row directly in each test
would make these tests brittle against schema changes.

The only usage in WMF production code was in WikiPage and has been
fixed.

Bug: T284955
Change-Id: I03a2bd9ed64fcc0281ee29a286c8db395a9e03d9
2021-09-10 16:00:02 +02:00
jenkins-bot
6ae92c0c73 Merge "Improve DeletePage tests" 2021-09-09 21:10:39 +00:00
jenkins-bot
1efeefe017 Merge "PageStore: Use LinkCache" 2021-09-09 20:04:47 +00:00
jenkins-bot
150a589ecf Merge "Title: restore behavior of getCascadeStrictionSources" 2021-09-09 19:41:48 +00:00
jenkins-bot
77a25b1568 Merge "Introduce TitleUrlTests" 2021-09-09 19:26:29 +00:00
jenkins-bot
69a0352f38 Merge "Make UserRightsProxy implement UserIdentity" 2021-09-09 16:27:04 +00:00
Derick Alangi
db43511e6a Title: Make use of BacklinkCacheFactory service
Change-Id: I48161585de6f329ec4037156234e0b07b3b837e6
2021-09-09 14:04:02 +01:00
jenkins-bot
9bb32a1f20 Merge "Add BacklinkCacheFactory Service" 2021-09-09 11:41:33 +00:00
jenkins-bot
6c353b4deb Merge "tests: Extract pure unit tests from TitleTest integration test" 2021-09-09 09:25:02 +00:00
jenkins-bot
74870b117a Merge "tests: Merge test cases of TitleMethodsTest into TitleTest" 2021-09-09 09:21:33 +00:00
Derick Alangi
96bc83e8eb Add BacklinkCacheFactory Service
Bug: T279433
Change-Id: I2943935e2d8148fce4457f76eca0234be72a5a5a
2021-09-09 09:58:52 +01:00
Inductiveload
5381c92e69 Revert "tests: suppress API prefix uniqueness check for 'pi'"
This is no longer required now that the prefix of the proofreadpage
meta query is set to 'prpi'.

This reverts commit d6db8f4ad0.

Bug: T290585
Depends-On: If2041873eac35806ae14645064d1f544142186e1
Change-Id: Ie7092cf26c4e55d324834f3478188498012f48cb
2021-09-09 08:35:24 +01:00
Reedy
4dae3b1a06 Rename four config variables to avoid 'blacklist' term
As part of our wider work on modernising and making more welcoming the
language we use within and around MediaWiki, now is a good time for us
to rename these configuration variables:

 - $wgFileBlacklist is now $wgProhibitedFileExtensions
 - $wgMimeTypeBlacklist is now $wgMimeTypeExclusions
 - $wgEnableUserEmailBlacklist is now $wgEnableUserEmailMuteList
 - $wgShortPagesNamespaceBlacklist is now $wgShortPagesNamespaceExclusions

Bug: T277987
Depends-On: I91e065c58fda144a722a41cf532e717f962d7a64
Change-Id: I558a8b20d67d48edccce0d065aec2d22992e9dda
2021-09-08 23:32:29 +01:00
Jdlrobson
4de7250830 Logos defined with pixels should be scaleable in browsers
This reverts commit bc200b6a1a reapplying
the patch. It has been modified slightly to temporarily work
with the beta cluster's unsupported configuration.

Bug: T207038
Change-Id: Ie86a5b59fbf93a400796a4cac3724207830092b5
2021-09-08 14:10:10 -07:00
Thcipriani
bc200b6a1a Revert "Logos defined with pixels should be scaleable in browsers"
This reverts commit 33ac451d3d.

Reason for revert: /wiki/Special:Version TypeError: Argument 1 passed to ResourceLoaderSkinModule::getRelativeSizedLogo() must be of the type array, boolean given, called in includes/resourceloader/ResourceLoaderSkinModule.php on line 600

Change-Id: Iddeb33d6165169dc106e9beb3e4a703a4b97eeb6
2021-09-08 20:13:32 +00:00
jdlrobson
33ac451d3d Logos defined with pixels should be scaleable in browsers
Bug: T207789
Change-Id: I358d2aa4b7e08a6507c87277dcfd29413efd0d6c
2021-09-08 18:32:37 +00:00
Daimona Eaytoy
1f86010f0f Improve DeletePage tests
Should have decent coverage now.

Bug: T288758
Change-Id: I2342f2072cd9c6d50831b9c3e7dd36f4a5e1c8e4
2021-09-08 17:37:52 +00:00
jenkins-bot
48717b18ae Merge "tests: suppress API prefix uniqueness check for 'pi'" 2021-09-08 17:17:43 +00:00
Derick Alangi
7d12da5595 tests: Extract pure unit tests from TitleTest integration test
-> Fixed TODOs such as adding test cases for namespaces that are
   not in `$wgNamespacesWithSubpages` in `testGetSubpageText()`.

-> Re-arranged provider methods to come before the test case as
   already in the files for consistency.

Change-Id: Ice2b3a07ea2ddd20417cbe87da93065e1812619e
2021-09-08 17:59:59 +01:00
Derick Alangi
043c2d5589 tests: Merge test cases of TitleMethodsTest into TitleTest
Change-Id: I31bfd91f393f7f69335687a4e7ca830f4831e2f3
2021-09-08 17:59:59 +01:00
jenkins-bot
5df94ae30e Merge "Make DeletePage a real service" 2021-09-08 16:56:39 +00:00
Inductiveload
d6db8f4ad0 tests: suppress API prefix uniqueness check for 'pi'
This is shared between ProofreadPage's proofreadinfo and PageImages.

As these two extensions are not installed on the same wikis (PRP is
Wikisource-only, PageImages is disabled on Wikisource), there is not
urgent need to change one or the other, as that will break API
stability.

So, simply disable the API prefix uniqueness check for now (following
the example of T196962), and migrate the PRP info API as a follow up,
giving API clients time to update.

Bug: T290585
Change-Id: I7c35f911f254dcb7d2fa21bbac67416209229dcc
2021-09-08 16:45:41 +00:00
daniel
abc2179820 Title: restore behavior of getCascadeStrictionSources
The behavior of getCascadeStrictionSources was changed by Ia73ea587586cb69eb5
to conform to the documented behavior: it would always return false as the
first element of the return value if there were no cascading restriction sources,
as specified in the documentation.

Hopwever, the previous behavior was to return an empty array in that
case, unless the $getPages parameter was false. That behavior seems more
senible, and there is existing code that relies on it.

This patch restores the previous behavior and updates the documentation
instead.

Bug: T218395
Needed-By: I31ca0a8987f9694bc3b312a48c2c111ceda6fa3e
Change-Id: I1f24703b80566220ac6fe8ee500e838ed7fd29af
2021-09-08 17:22:17 +02:00
James D. Forrester
a362b2cff0 CollationTest: Be more specific with @covers
Change-Id: I1470fbf55efb401867d1cc0e53ef1a66b9a1f21c
2021-09-08 13:46:58 +00:00
Daimona Eaytoy
73f0ae36a3 Make DeletePage a real service
- Switch do actual DI
- Add some more parameters for needed dependencies
- Create a factory interface, implement it in PageCommandFactory and add
  wiring for it.
- Add new unit tests for DeletePage; unfortunately, this requires
  conditionally disabling some code during tests due to dependencies on
  legacy code that hasn't been migrated yet. I believe that these
  temporary hacks are acceptable, since they allow us to use real unit
  tests immediately.
- Adjust WikiPageDbTest: the two logging tests were identical as of
  Ie0d9da2c8d273c93301921e1e108d9ffb381b8a5; and then the logging part
  could just be part of the "main" test.
- Add integration tests for DeletePage. For now, these are all copying
  their WikiPageDbTest counterpart. More tests will be added soon™.

Bug: T288758
Change-Id: I2fb79ed905ce621cb87f0658983d97148948da28
2021-09-08 11:43:04 +00:00
daniel
737d733aff Introduce TitleUrlTests
Change-Id: I26e2e06ed3aa179a0b517d5df032ebf659fefd6e
2021-09-08 07:48:45 +00:00
jenkins-bot
d74de7f9eb Merge "Make WikiPage a ProperPageIdentity" 2021-09-07 19:48:14 +00:00
jenkins-bot
79615a43c1 Merge "Drop wgAjaxEditStash, deprecated in 1.36" 2021-09-07 16:45:22 +00:00
jenkins-bot
8ff1e8e74b Merge "Remove PasswordCannotMatchUsername password policy" 2021-09-07 15:24:31 +00:00
Derick A
7ebf05256a tests: Cover more methods in the Title::class (increase code coverage)
The methods that have been covered in this patch are listed below:
~ Title::hasFragment()
~ Title::getFragment()
~ Title::setFragment()
~ Title::isMainPage()
~ Title::equals()
~ Title::getPrefixedURL()
~ Title::prefix()
~ Title::__toString()
~ Title::getFullText()

Bug: T241406
Change-Id: I51ffadb52e7eef822e9e619e5132513dc1501f9b
2021-09-07 13:58:38 +00:00
jenkins-bot
e21048c084 Merge "tests: Use service container in integration tests cases" 2021-09-07 11:46:47 +00:00
Daimona Eaytoy
613a874635 rdbms: Add more return typehints
See full rationale at I59068cfed10aabf6c6002f9e9312a6ef6e7e9441.
Using IDatabase for now instead of DBConnRef for better BC.

Change-Id: Ie75aaf46ba91779e8706b10efeefa9580857f489
2021-09-07 08:23:36 +00:00
Timo Tijhof
761b7c1080 resourceloader: Re-enable mw.loader.store tests
The tests now work regardless of whether the underlying wiki or browser
would normally have the store enabled (via
wgResourceLoaderStorageEnabled, or in Firefox, or in debug mode).

Bug: T245693
Change-Id: Ib1f8867ae7ba585b7efd11e1a8692fa7da16eb28
2021-09-06 21:49:34 +00:00
Reedy
7a17473dd1 Remove PasswordCannotMatchUsername password policy
Bug: T242768
Change-Id: Ied6fe389a1ce6c66cbf558d2f3867fb12245ff8a
2021-09-06 14:55:12 +00:00
Alexander Vorwerk
2fbf13812a WikiExporter: inject services
This patch injects services into WikiExporter. It also adds a
WikiExporterFactory service for creating WikiExporter instances.

Change-Id: Ib1547defea54c309865c116bc83d617c21568843
2021-09-06 10:03:37 +00:00
Derick Alangi
e894dc75fa tests: Use service container in integration tests cases
Since MediaWiki 1.36, this method is provisioned to replace creating
new instances of the services object. If one is already created and
seen by the service locator, just use it.

Change-Id: I9509497a8380194aa93310343b1896521070fc31
2021-09-05 22:14:36 +01:00
jenkins-bot
02f7392231 Merge "Make ReadOnlyModeTest a pure unit test" 2021-09-05 21:07:05 +00:00
Alexander Vorwerk
cdaff4efbc Make UserRightsProxy implement UserIdentity
This is done to allow a more easy transition away from UserRightsProxy.

Bug: T255309
Change-Id: I730d28c12ad389e001f18c12662d220cb74f998e
2021-09-05 16:51:25 +02:00
Timo Tijhof
d7dee58047 resourceloader: Make mw.inspect test resilient against line breaks
== Backgrond ==

When working on an unrelated patch (Ib1f8867ae7ba585b), the tests for
mw.loader.store failed both locally and in CI, consistently, claiming
that the mw.inspect() size for this test case was now 371 instead of
372. It still passed on master where it adds up as 372.

How can this be? Well. Our tests don't run in debug mode, which means
the test suite code is minified. That shouldn't make a difference in
terms of how the code works since all statements, data, and function
calls perform the same either way. And indeed, the part of mw.inspect
that serializes arrays and objects, was unaffected.

It doesn't matter if `x = [ 'a', 'b' ]` or `x=['a','b']`. The data
seen at run-time is identical in every observable way. And thus it is
fully in the hands of mw.inspect() to choose how to measure its size
(e.g. it could call JSON.stringify with or without indentation, but
either way it's going to be consistent and unaffected by how the JS
code was formatted when the array is defined).

But.. it's different for functions. When we measure the size of a
function, we ask the JS engine to reflect back to use the source code
via Function#toString. This exposes details of minification. That's
still okay, in that the expected size of 372 is the size with this
minification taken into account.

== The problem ==

A good minifier should be deterministic given the same input, and our
minifier is no different. But, what kind of change do we expect when
the input does change? Well, in our case, we minify the code into
lines of upto around 1000 characters. This means every once in a while
a line break is let through.

In my unrelated patch, the amount of code above this test case
changed, so it changed where each compression chunk starts and ends,
and thus ended up no longer placing a line break in one of this test
case's functions.

== The fix ==

Define this function with a string literal and eval, so that it is
unaffected by minification.

== Long term ==

These kinds of subtle differences in optimisation are common to most
minifiers, and are thus unavoidable in practice. The better solution
I think is to run  our tests in debug mode. I already intend to do
this after T250045, and this patch is another reason to do that,
albeit the first time in 11 years that we've run into this!

Change-Id: Ibab369ae193a7b99616da1ccef93ab4850b8686a
2021-09-05 03:12:42 +00:00
jenkins-bot
3f12217fe6 Merge "Hard deprecate User::getBoolOption()" 2021-09-04 20:17:00 +00:00
Alexander Vorwerk
3f06dfb475 Hard deprecate User::getBoolOption()
deprecated since 1.35

Bug: T277600
Change-Id: I54cea0dc589dc5bb7ed3b4ecceaa62b693b104d7
2021-09-04 09:52:06 +02:00
DannyS712
bd73c48744 StubObject: add magic __get() and __set()
We will soon be converting $wgUser to be a stub
object wrapping a User, and we want to be able
to access the public properties of that object
(doing so will still trigger deprecation warnings,
but it won't break). This will also work for
non-existent properties that are handled via
the __get() and __set() methods of whatever
inner object the StubObject is wrapping.

Bug: T267861
Change-Id: I4c29c615bcb107d4ef8bf4b8e48db2ecf863e5f7
2021-09-04 05:37:25 +00:00
jenkins-bot
22fde5e3c9 Merge "collation: Create CollationFactory service" 2021-09-04 01:28:13 +00:00
jenkins-bot
83943e3187 Merge "FormatJson: Optimize encode() for supported PHP versions" 2021-09-04 01:24:12 +00:00
Umherirrender
5b3d3ef802 collation: Create CollationFactory service
Use ObjectFactory specs for collation classes
Avoid the language construction in the factory class,
make it a detail of the implementation of each class

Follow-Up of Ifc96f851e6091ce834dbaf0e91695c648a42169c

Bug: T286079
Change-Id: Ib581f64aec8619986fb8dd49ceee0524d59a1b84
2021-09-04 02:46:06 +02:00
Umherirrender
2e4ee47c3d Cleanup mixed space/tab line indent
Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
2021-09-04 00:52:31 +02:00
jenkins-bot
c9e8d7e49d Merge "DatabaseMysqlBase: Rename getMasterServerInfo to getPrimaryServerInfo" 2021-09-03 21:23:29 +00:00
jenkins-bot
472900119f Merge "ExternalStoreDB: Rename getMaster to getPrimary" 2021-09-03 21:23:23 +00:00
jenkins-bot
c6d4568a7b Merge "docs: Improve doc types around changes list and the changes special page" 2021-09-03 20:58:48 +00:00
James D. Forrester
b81dfed73e DatabaseMysqlBase: Rename getMasterServerInfo to getPrimaryServerInfo
Hard-deprecating immediately as no known users in git outside of this repo.

Bug: T282894
Change-Id: I79310cafeae368aa2a06b4eec69359663fa11e9d
2021-09-03 20:45:05 +00:00
James D. Forrester
eeaec4ce6b ExternalStoreDB: Rename getMaster to getPrimary
Bug: T282894
Change-Id: I6d6361a0b84f7130a27df6a6c75a983c73e5dd95
2021-09-03 13:44:04 -07:00
James D. Forrester
07f9d1db49 Database: Rename assertIsWritableMaster to assertIsWritablePrimary
Hard-deprecating immediately as no known users in git outside of this repo.

Bug: T282894
Change-Id: I5c8152b3d4b58e49a641b235532e40b06362b7c2
2021-09-03 20:11:17 +00:00
James D. Forrester
3983572c49 ILoadBalancer: Rename forEachOpenMasterConnection to forEachOpenPrimaryConnection
Bug: T282894
Change-Id: I4892084aba6c7fdfbeccec42de88b9f23490b61c
2021-09-03 13:05:23 -07:00
James D. Forrester
02d04502c9 Switch uses of ILoadBalancer::approveMasterChanges to ::approvePrimaryChanges
Bug: T282894
Change-Id: Iba3aa865d49af2836f3c6af15de307a289a32a2b
2021-09-03 09:59:56 -07:00
Gergő Tisza
86fcccf0a8 Message: Remove deprecated format property
Remove Message::$format and the $format parameter of
Message::toString(), soft-deprecated in 1.26 and hard-deprecated
in 1.36. Also make the signature of toString() stricter.

Bug: T146416
Change-Id: I19aa3e482968dea5164afb93b04a55f27c644ce6
2021-09-03 09:21:12 -07:00
jenkins-bot
cc3e84aaf0 Merge "ILoadBalancer/ILBFactory: Rename hasOrMadeRecentMasterChanges to hasOrMadeRecentPrimaryChanges" 2021-09-03 03:44:06 +00:00
jenkins-bot
5d2c5c48c3 Merge "ILoadBalancer/ILBFactory: Rename hasMasterChanges to hasPrimaryChanges" 2021-09-03 03:42:10 +00:00
jenkins-bot
61f816f602 Merge "mediawiki.api: Support loading more than 50 messages, through batching" 2021-09-03 02:58:17 +00:00
jenkins-bot
31eca8f36e Merge "Remove PHPUnit hooks" 2021-09-03 02:46:52 +00:00
DannyS712
f2072d2bf2 mediawiki.api: Support loading more than 50 messages, through batching
Previously, getMessages() only worked with fewer than 50 messages
(depending on user rights), and reject with API error "toomanyvalues"
if asking for more.

Bug: T290208
Change-Id: Icc5711a0017eff25788b4fb71b8ab7ec25ef0efe
2021-09-03 02:39:21 +00:00
James D. Forrester
8a659ca2fe ILoadBalancer/ILBFactory: Rename hasOrMadeRecentMasterChanges to hasOrMadeRecentPrimaryChanges
Bug: T282894
Change-Id: I1d6130bcd09019f9e2de2974878902c7aafe8f0a
2021-09-02 16:34:44 -07:00
James D. Forrester
2cfcca23f5 ILoadBalancer/ILBFactory: Rename hasMasterChanges to hasPrimaryChanges
Bug: T282894
Change-Id: Ief9cda8fece28c7f515ca30d0154f1e24559f687
2021-09-02 16:14:01 -07:00
jenkins-bot
95e0a4e894 Merge "debug: Return early in wfDeprecated(), and improve docs" 2021-09-02 22:13:12 +00:00
jenkins-bot
f0a6771acb Merge "ILoadBalancer/ILBFactory: Rename rollbackMasterChanges to rollbackPrimaryChanges" 2021-09-02 21:25:44 +00:00
jenkins-bot
9a694ef656 Merge "ILoadBalancer: Rename runMasterTransactionListenerCallbacks to runPrimaryTransactionListenerCallbacks" 2021-09-02 21:20:49 +00:00
jenkins-bot
82b05e7361 Merge "ILoadBalancer: Rename runMasterTransactionIdleCallbacks to runPrimaryTransactionIdleCallbacks" 2021-09-02 21:15:12 +00:00
jenkins-bot
85e96dabaa Merge "IDatabase: Rename getTopologyRootMaster to getTopologyRootPrimary" 2021-09-02 21:04:56 +00:00
James D. Forrester
10324c232a ILoadBalancer/ILBFactory: Rename rollbackMasterChanges to rollbackPrimaryChanges
Bug: T282894
Change-Id: I31794e052d71160195dd3b6c29fea24bc98b356b
2021-09-02 12:50:52 -07:00
jenkins-bot
adf1e70574 Merge "Add tests for comment formatting methods in Linker" 2021-09-02 19:45:53 +00:00