Commit graph

106978 commits

Author SHA1 Message Date
Dan Duvall
d83a7bcd09 Cache loading of SettingsBuilder sources
The `SettingsBuilder` now accepts a PSR-16 cache interface with which to
store and query settings before attempting to load from each source. By
default, no cache is used, but any object that implements the
`Psr\SimpleCache\CacheInterface` may be provided to the constructor.

An explicit dependency on "psr/simple-cache" has been added to
`composer.json`. Note that this dependency already existed in vendor
albeit it as a transitive one.

An APCu based `SharedMemoryCache` adapter is provided as a canonical
PSR-16 compliant interface for production use.

Sources are now queued by the `SettingsBuilder` when calling `load()`.
If a cache interface has been provided, and the source is considered
cacheable (implements `CacheableSource`), then it is wrapped as a
`CachedSource` which will query the cache first before loading from the
wrapped source.

Cache stampedes are mitigated using probabilistic early expiry. The
implementation for this was partially based on symfony/cache-contract
source code but also from the Wikipedia article and paper referenced
therein.

See https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration

Bug: T294748
Change-Id: I52ab3899731546876ee58265bd4a1927886746dc
2021-11-29 12:54:59 -08:00
jenkins-bot
e00f24a11e Merge "SettingsBuilder: Add YAML file format." 2021-11-29 20:51:49 +00:00
jenkins-bot
94294b97c2 Merge "Use UndeletePage from Special:Undelete" 2021-11-29 17:54:12 +00:00
Petr Pchelko
120ef51cbf SettingsBuilder: Add YAML file format.
If php-yaml extension in installed, use that. Otherwise
we fallback to symfony Yaml parser.

php-yaml is about 20 times faster then symfony, for default-settings.yaml
it will take PHP-yaml 6ms to load it vs 100ms for symfony. But given
that the result will be cached, it's better not to bring in
a required native dependency.

Bug: T294751
Change-Id: I3ffde926c3f264cacf39810ff7bd338c9f78823d
2021-11-29 09:27:20 -08:00
jenkins-bot
1d3b49bd8b Merge "rdbms: Add DB host to TransactionProfiler logging and fix time fields" 2021-11-29 16:33:07 +00:00
Amir Sarabadani
7f54729e20 rdbms: Add DB host to TransactionProfiler logging and fix time fields
DB hostnames are extremely useful in getting the info when they are on
different MariaDB versions for example or their table stats need
refreshing.

Time fields are not being counted as numbers in Logstash because these
values are conflicting with other values that are string. Let's fix it.

Bug: T295706
Change-Id: Iff1c1087a7b64a51b5cbd7ecf13afc87d452c352
2021-11-29 16:14:04 +00:00
jenkins-bot
f9ef38f6a5 Merge "Add Makhuwa (vmw) to Names.php" 2021-11-29 08:48:47 +00:00
Amir E. Aharoni
0407689e8c Add Makhuwa (vmw) to Names.php
Bug: T296612
Change-Id: I70b3ca826a7c74ed2894a2c9456b2800da9e7633
2021-11-29 09:34:09 +02:00
Translation updater bot
675fc21afa Localisation updates from https://translatewiki.net.
Change-Id: Ie462c3c78576eb5576499966ae08a2b1a48f512c
2021-11-29 07:55:55 +01:00
jenkins-bot
fa26283566 Merge "ILBFactory: Add @throws for newExternalLB/getExternalLB" 2021-11-28 16:10:44 +00:00
jenkins-bot
4ca40c2243 Merge "Fix missing history-deleted class for suppressed revision on changeslist" 2021-11-28 14:51:55 +00:00
Martin Urbanec
f03ce90ece getReplicaServer: Handle clusters
This will be useful for the Growth team, which intends
to release a DB table that currently resides at the x1 cluster.

Bug: T291966
Change-Id: I55fa417e779a0aa847c7b8e630977553641f46df
2021-11-28 15:13:16 +01:00
Martin Urbanec
a1683f52c6 ILBFactory: Add @throws for newExternalLB/getExternalLB
Change-Id: I98d0a44a42aa8a98844927e187937213fa5b7041
2021-11-28 15:09:29 +01:00
Umherirrender
bb8d3e0d68 Fix missing history-deleted class for suppressed revision on changeslist
For comment and content the class mw-history-suppressed is added
additional, should be the same for the user.

Follow-Up: I08f14f712479e1b170c606e2b64857f8386acd76
Change-Id: I7d477913952b9cc67314d1ec96f83db2846a74cb
2021-11-27 23:49:12 +01:00
jenkins-bot
a346d18f28 Merge "Add stylesheet for history-deleted for file history on file pages" 2021-11-27 20:22:48 +00:00
jenkins-bot
701b77930b Merge "Use LinkRenderer instead of building link HTML manually" 2021-11-27 08:28:50 +00:00
jenkins-bot
24768db801 Merge "Revert "Remove last User dependencies from File"" 2021-11-26 17:33:52 +00:00
Majavah
7e3df796b0 Revert "Remove last User dependencies from File"
This reverts commit 73a25838b4.

Reason for revert: T296508

Bug: T296508
Change-Id: I8af37665eeb284b85157a72459d43261ec4829ed
2021-11-26 17:06:36 +00:00
jenkins-bot
5af03f9199 Merge "composer.json: Swap composer foo for @foo" 2021-11-26 13:53:11 +00:00
jenkins-bot
d70bb04dda Merge "StatusValue: improve toString formatting" 2021-11-26 08:48:17 +00:00
jenkins-bot
0eb3d96e26 Merge "Localisation updates from https://translatewiki.net." 2021-11-26 07:54:09 +00:00
jenkins-bot
cd483f83de Merge "GetConfiguration: Allow partial output with JSON encoding" 2021-11-26 07:29:37 +00:00
Translation updater bot
af196c9156 Localisation updates from https://translatewiki.net.
Change-Id: I54371a39a2256a942b5e8136402efebb0fb733aa
2021-11-26 08:04:05 +01:00
Gergő Tisza
0ff1138537
StatusValue: improve toString formatting
Don't just cut off the message key at 25 characters, it makes
debugging very annoying. But do cut off the parameter at some
reasonable length, it could be arbitrarily large.

Change-Id: I8a2665434d6370477eb36a6827eb634e230d280a
2021-11-25 21:53:21 -08:00
Petr Pchelko
73a25838b4 Remove last User dependencies from File
Change-Id: I953fcc66b5cde1ef481178b08e16c50b8a118702
2021-11-26 05:42:00 +00:00
jenkins-bot
992c592f7d Merge "Introduce setting PHP_INI env configs via a settings source" 2021-11-25 21:47:33 +00:00
Translation updater bot
e517052a13 Localisation updates from https://translatewiki.net.
Change-Id: I748c15eda4c81cc646f3c50c076882cd382a97b9
2021-11-25 08:06:19 +01:00
Derick Alangi
dce6673430 Introduce setting PHP_INI env configs via a settings source
This feature enables the SettingsBuilder to be able to set php-ini
environment variables at run-time.

We just do so by specifying the various key/value pairs to the `php-ini`
key like below:

```
"php-ini": {
    "key": "value",
    ...
}
```

This will allow us to set things like `display_errors`, `memory_limits` etc.

Bug: T294752
Change-Id: I2ff0e7abc010342537bbaf1e1b71fb84d02a153b
2021-11-25 01:20:35 +01:00
jenkins-bot
8f96ab9cee Merge "Use MW_CONFIG_FILE constant for config path in Setup.php" 2021-11-24 23:27:26 +00:00
jenkins-bot
9d0240d884 Merge "Don't throw away '0' edit summary" 2021-11-24 23:07:24 +00:00
Adam Wight
440633a1e5 Use MW_CONFIG_FILE constant for config path in Setup.php
The config file path can be overridden, so we should use the defined
constant rather than hardcoding a path.  The intention of this logic
is to purge cache with the active config changes, so it's more correct
to check the mtime of the file in use.

Change-Id: Iac5fa2af4021ab8c1a0532b46b3bbc02641c682a
2021-11-24 22:59:17 +00:00
jenkins-bot
3a634eafa7 Merge "MoveBatch.php: Minor code cleanup" 2021-11-24 20:10:58 +00:00
jenkins-bot
a703ab5bce Merge "MultiHttpClient: Check if $wgLocalHTTPProxy is false, not null" 2021-11-24 20:01:54 +00:00
Reedy
ece215199d MoveBatch.php: Minor code cleanup
* Swap == for ===
* Rename a couple of local variables to match common naming patterns
* Remove old chdir(); not needed now the code no longer uses commandLine.inc

Change-Id: Iabae9b6f4bf57309a7f06cb6740db60e473e1ff2
2021-11-24 19:47:21 +00:00
Daimona Eaytoy
5611cdeb7e Use UndeletePage from Special:Undelete
Fix return value of UndeletePage by preserving warnings from fileStatus
and revisionStatus.

The only user-facing difference is that now revision and file errors are
handled together, i.e. included in the same error message.

Also hard-deprecated now unused PageArchive methods. The only usage
seems to be in Ext:Video, which has a full copy of core's
SpecialUndelete anyway...

Bug: T290021
Change-Id: I30394f818220120b421d6b07a26d1e03bfbbc999
2021-11-24 19:25:06 +01:00
Reedy
8999e0c402 composer.json: Swap composer foo for @foo
Change-Id: Ib65ad97e49ba1b847c19ce1805f32b42382882cd
2021-11-24 16:40:11 +00:00
Kosta Harlan
198a09da4e GetConfiguration: Allow partial output with JSON encoding
Add a config flag to allow for partial output on error. An extra
configuration variable is exported with the result so the client can
know that an error occurred during serialization.

Misc:

* Remove the unneeded $out variable null declaration

Bug: T294786
Change-Id: I8f8f504cf614cbd81323f536e7ea255a4aff5907
2021-11-24 14:05:12 +00:00
jenkins-bot
3cec686d81 Merge "tests/phpunit/unit/includes/tidy/html5lib-tests.json: Avoid use of 'insanely' in comments" 2021-11-24 12:17:08 +00:00
James D. Forrester
335fa70fbf tests/phpunit/unit/includes/tidy/html5lib-tests.json: Avoid use of 'insanely' in comments
Bug: T254646
Change-Id: Ic193c41c8072266e70946ccb437ce42a4544fad3
2021-11-24 11:46:36 +00:00
jenkins-bot
822baf22b7 Merge "Rename variables to disambiguate OutputPageParserOutput hook" 2021-11-24 11:08:39 +00:00
jenkins-bot
d672641fa6 Merge "Hard-deprecate ParserOutput::hasDynamicContent()" 2021-11-24 11:08:34 +00:00
Matěj Suchánek
50b010e5e8 Don't throw away '0' edit summary
Those "$comment ?? ''" are a bit ugly, but the other way around is
changing the return values of some ::getDescription implementations,
which is dangerous, at least.

Change-Id: I07e6b58258c256d19b058c56280150b70a46b407
2021-11-24 10:33:36 +00:00
jenkins-bot
858d803744 Merge "Remove @unstable tag from ParserOutputAccess" 2021-11-24 10:08:33 +00:00
daniel
c839155dc0 Remove @unstable tag from ParserOutputAccess
ParserOutputAccess was introduced in 1.36, time to call it stable in
1.38.

Change-Id: Idf8928b87e841bc8837df2e56b09841fc104e25f
2021-11-24 09:42:38 +00:00
Translation updater bot
ffc20ef217 Localisation updates from https://translatewiki.net.
Change-Id: I19c49104203db62869760d08a1ad13d44b26ce28
2021-11-24 08:03:47 +01:00
C. Scott Ananian
4a04259070 Rename variables to disambiguate OutputPageParserOutput hook
It can be difficult to distinguish between ParserOutput and OutputPage
values, since both are often named $out or $output.  Use more
distinctive variable names to make it easier to read the code (and use
code search) for uses of the OutputPageParserOutput hook, where both
types are present in close proximity.

See T293860 for an instance of this confusion biting us in production,
and I386e99df01f889a80de26e861142bdb606aa649d for a related tidying-up
in Wikibase.

Change-Id: I0ccb7484eb3b2e2ae6a5a85c3e08d7d48b1e6146
2021-11-23 15:50:01 -05:00
C. Scott Ananian
59d728f136 Hard-deprecate ParserOutput::hasDynamicContent()
This method was renamed in 1.37 to ::hasReducedExpiry() and only has a
single use in core (and no uses outside of core, as far as I can
tell).  Rename the single use and deprecate the old name.

Code search:

https://codesearch.wmcloud.org/search/?q=hasDynamicContent&i=nope

Change-Id: Ie2bea78e31433a01a5590becc06f32294b04522e
2021-11-23 15:40:46 -05:00
Kunal Mehta
5cadb281d6 MultiHttpClient: Check if $wgLocalHTTPProxy is false, not null
The default not configured value for $wgLocalHTTPProxy is false, not
null. So in MultiHttpClient make sure it defaults to false and check for
false when deciding whether to use the proxy.

MWHttpRequest already has the correct behavior.

Bug: T296312
Change-Id: I3962c24f9cb159fb7d1e194e59c8bef5261371c3
2021-11-23 10:17:50 -08:00
jenkins-bot
daddb105a3 Merge "PageStore: avoid getPageById, since it bypasses caching." 2021-11-23 15:41:32 +00:00
jenkins-bot
6eed34a0a9 Merge "Clean up MessagesSmn.php" 2021-11-23 15:35:42 +00:00