Commit graph

1541 commits

Author SHA1 Message Date
jenkins-bot
3c3c28aa6a Merge "profiler: Drop support for Tideways 4.x in ProfilerXhprof" 2022-11-28 06:35:24 +00:00
Kevin Israel
b3a2c88cea profiler: Drop support for Tideways 4.x in ProfilerXhprof
This branch fails to compile against PHP 7.4.3, our lowest supported
version, and will not be updated to support that or any newer version:

https://tideways.com/profiler/blog/releasing-new-tideways-xhprof-extension

In doing so, remove the Xhprof class. At this point, it doesn't do
anything other than calling either of two functions from whichever
extension is installed, which can just be done in ProfilerXhprof.

Change-Id: Iba1c16f47c68b36982f5d2dcda3bdf4dcb83501d
2022-11-28 06:20:45 +00:00
jenkins-bot
3f44589512 Merge "tests: Replace assertEmpty with assertSame" 2022-11-26 10:04:19 +00:00
Amir Sarabadani
09b18a8f4c Reorg: Move Title-related classes to title/
These three classes:
 - TitleArray
 - TitleArrayFromResult
 - TitleFactory

We need to move these and the rest of files under title/ to Title/ (and
namespace them) but the patch will become way too big given that Title class is
also one of them.

Bug: T321882
Change-Id: Iac1688172ee457348a08a470c86e047571feb8e0
2022-11-26 09:30:32 +00:00
Umherirrender
c6fecd5ab0 tests: Replace assertEmpty with assertSame
assertSame avoids use of loose comparisons and
allows to check the expected type

Change-Id: If821d1be2bc1ff9f8b70968a339f33c7a8e8880a
2022-11-25 00:42:53 +01:00
jenkins-bot
a94b359376 Merge "Implement LanguageConverter for sh.wiki" 2022-11-24 22:28:46 +00:00
Aaron Schulz
23eab3ec39 rdbms: make SqlitePlatform::tableName() apply double quotes
The RDBMs classes treat table names as application-supplied rather
than user-supplied, since it does not make sense for the user to be
able to blindly pick the schema (likely causing query errors). Table
names are generally non-problematic [a-zA-Z0-9_]+ strings. However,
they still should be escaped as identifiers, since they might have
problematic characters. Fix the SQLite backend to apply escaping
here, similar to MySQL and Postgres.

Fix incorrect use of tableName() in DatabaseSqlite::fieldInfo().
It should work the same as in tableExists().

Bug: T72510
Change-Id: I3713f81e6e1eca84cc51c12c9307d4c5dc737043
2022-11-23 00:17:40 +00:00
jenkins-bot
a34d3672ac Merge "password: Reduce time cost of password unit tests" 2022-11-22 23:05:52 +00:00
jenkins-bot
a828974c17 Merge "password: Update Argon2Password for PHP 7.4 minimum" 2022-11-22 23:04:00 +00:00
Tim Starling
21e7131d17 password: Reduce time cost of password unit tests
Remove Argon2PasswordTest::testPartialConfig(). It's irreparably slow
and doesn't seem to test anything useful, just that the defaults are
the defaults. It was added in PS5 of Ifdf648f5d8a734a663e6 as part of a
change which removed explicit cost defaults from DefaultSettings.php.

Reduce time costs of some other tests.

The time to execute tests in this directory is reduced from ~1.3s to
~0.5s.

Bug: T225730
Change-Id: I30b846b5364ad2030e2547da6c58db13eaf401f2
2022-11-22 22:48:10 +00:00
Tim Starling
28f65f252e password: Update Argon2Password for PHP 7.4 minimum
In PHP 7.4, it's possible to compile password without Argon, but if
Argon is compiled in, both algorithms should be available.

So:

* Remove Phan stubs
* Simplify class code
* Add test per todo

Change-Id: I749d456ad59698e5b1538b127586ea796efba1d1
2022-11-22 22:47:42 +00:00
jenkins-bot
b7a12fd9fd Merge "Protect against long match length in CHAR_REFS_REGEX" 2022-11-22 21:04:17 +00:00
jenkins-bot
50b187c5ff Merge "BagOStuff: never use the full cache key as metrics key" 2022-11-21 18:02:27 +00:00
daniel
df9a729e57 BagOStuff: never use the full cache key as metrics key
When the cache key doesn't contain a prefix indentifying the collection,
don't use the entire cache key as the metrics name. Doing so may explode
the number of metrics.

Bug: T323357
Change-Id: Ia7ff3f060a36f848c7a74e39070bd62a932120e7
2022-11-21 14:03:44 +01:00
thiemowmde
0b80e9ebcc Fix incomplete ITextFormatter mocks
Otherwise the mocked getLangCode() method returns null, which is not
allowed any more in PHP 8.1.

Bug: T289926
Required-For: I7e026cca216aba24ee5d5662b6fca322b3cec9ae
Change-Id: I178def7f03a44f6b49cdb461d9ab340e1c89517f
2022-11-21 10:00:57 +01:00
jenkins-bot
614e496345 Merge "HookContainer: add getHookNames method" 2022-11-21 01:48:02 +00:00
jenkins-bot
febb772f23 Merge "REST: introduce applyCacheControl()" 2022-11-21 01:39:05 +00:00
daniel
d70fbfc691 REST: introduce applyCacheControl()
This adds applyCacheControl() to the Handler base class.
REST handlers can override this method to apply cache control to the
response.

Change-Id: Ib31b91a0048dbc57fbcadfec6533e672c1567509
2022-11-21 01:22:34 +00:00
jenkins-bot
22e62b9fda Merge "Miscellaneous PHP version related cleanups" 2022-11-20 23:59:47 +00:00
Tim Starling
28750729bd Miscellaneous PHP version related cleanups
MediaWikiTitleCodec: I removed the comment about dbkey being
"conveniently nullified" since that is no longer correct. The first
preg_replace() can return null, and that is guarded. The second
preg_replace() hopefully can't return null, because if it does, trim()
will generate a deprecation notice on PHP 8.1.

Some other self-explanatory changes.

Change-Id: Iad0ace821eba782c3033ec8abfeac461ac4e8ace
2022-11-21 10:11:53 +11:00
C. Scott Ananian
6153062d48 Protect against long match length in CHAR_REFS_REGEX
Some malformed pages contain "character references" that were so long
that they caused PHP's `hexdec` to return a `float` instead of an
`int`.  This caused Parsoid to crash on a type hint on the argument to
Sanitizer::validateCodepoint().  MediaWiki core has the same issue,
but doesn't have the type hint (yet), so soft-fails instead of
crashes.  Add sanity checks around each call to `hexdec` to protect
against arbitrarily-long entity strings (while allowing arbitrary
zero-padding), and add a note to `intval` to explain why it is not
similarly affected.  New test cases added to SanitizerUnitTest as
well.

Corresponding patch on the Parsoid side:
Ic33196961bb2b86290148fbc3ce33bcd8b28ab56
(And see T247804 re: eventually removing this duplicate code.)

Bug: T322892
Change-Id: I5085c4edbb86e282b92536d05b01ed5f9d5c615e
2022-11-17 16:47:39 -05:00
jenkins-bot
2562d05fa1 Merge "Metrics: move metric implementations to subdirectory" 2022-11-17 19:19:44 +00:00
jenkins-bot
e5ad12f3bc Merge "Metrics: expand Sample instance parameters" 2022-11-17 19:19:17 +00:00
jenkins-bot
47c08b164c Merge "Metrics: rename extension to component" 2022-11-17 19:11:07 +00:00
jenkins-bot
380aef9d96 Merge "rdbms: improve TransactionProfiler::silenceForScope()" 2022-11-17 07:53:29 +00:00
daniel
477c8952fe HookContainer: add getHookNames method
This proves a way to list all active hooks.
ApiQuerySiteInfo was relying on $ghHooks, which does not contain hooks
that were registered by extensions using the new hook handler system.

Change-Id: Ifae205f22ab4cc7ae0dfd15e994a1921af51b05c
2022-11-16 11:54:39 +00:00
Aaron Schulz
6c3ec6b61f rdbms: improve TransactionProfiler::silenceForScope()
Make it able to silence only specific expectations. This means that
rules like "masterConns = 0" and "writes = 0" can be silenced, while
rules like "readQueryTime" and "writeQueryTime" remain in place.

Also, do not increment counters for silenced rules. Otherwise, it
might trigger again on something harmless after the scope ends.

Cleanup event/expectation terminology/naming.

Use time mocking in TransactionProfilerTest.

Bug: T258125
Change-Id: I6e5da5051668fadc5a6ad1955c2cb01ef3d477b6
2022-11-15 23:46:58 +00:00
Acamicamacaraca
a573bea01b Implement LanguageConverter for sh.wiki
This patch will implement a one-way transliterator (Latin->Cyrillic), per community consensus.

Bug: T268033
Change-Id: I6f3e7efe3630e9960584dca3a5ee55cb92ea722c
Co-Authored-By: Deni <deni@deni.dk>
Co-Authored-By: Winston Sung <winston21.sung@gmail.com>
2022-11-15 06:29:11 +00:00
Reedy
116b71452c tests: Simplify some nested ->will( $this->return assertions
Change-Id: Ic861ce5604784b7fa600844d81387b84230bc0e1
2022-11-12 11:57:12 -07:00
Reedy
27ee63f8c9 Remove pre PHP 7.4 serialize()/unserialize()
Depends-On: I3b893152ed278a72b5e74ccf91a3381f319bfcd9
Change-Id: I9f69a9316eaec23103262ec2ffd5b85baaf16f3f
2022-11-10 19:25:01 +00:00
Aaron Schulz
f6fec396c5 objectcache: use WRITE_BACKGROUND in WANObjectCache where applicable
This avoids the latency of waiting for a response.

Change yieldStampedeLock() to use delete() instead of changeTTL() since
the PECL memcached client does not support WRITE_BACKGROUND with TOUCH.

Also, simply relayVolatilePurges() into relayVolatilePurge() and tweak
some related documentation for WANObjectCache

Bug: T302623
Change-Id: I16f011b730f34332aa54a48c579de3c6606dafda
2022-11-09 21:17:03 +00:00
Cole White
784598add8 Metrics: move metric implementations to subdirectory
Bug: T240685
Change-Id: I38e8f9fac12542909364f06e0484cc1355796673
2022-11-09 19:53:32 -01:00
Cole White
dd70f21c68 Metrics: expand Sample instance parameters
* Eliminates use of associative array
 * Renames $labels to $labelValues
 * Renames Sample()->getLabels() to getLabelValues()

Bug: T240685
Change-Id: Ic97afd06a98a874bd006946eb8f82e8e2b457e63
2022-11-09 18:08:18 -01:00
Cole White
4a2935a765 Metrics: rename extension to component
Bug: T240685
Change-Id: Ia5ddfddf81685446ab7da3f0b5c415c8989afb7f
2022-11-09 17:41:06 -01:00
daniel
8c1c1ae35a Enable pig-latin variant for testing
Having pig-latin enabled per default in dev environments is convenient
for manual testing. More importantly, it will allow us to write
end-to-end tests for variant conversion.

Depends-On: I9dc2f743ac487b0f7cfb667150c0f6950d5e7fce
Depends-On: I85b66c85be3959d48a048733af17197bc4cf70af
Change-Id: Ia80ad33cbf5e311fa8b84bd765a8df8d156f4c38
2022-11-08 17:45:51 +05:30
Amir Sarabadani
7690ab4e33 Reorg: Move HeaderCallback to Request directory
Cleaning root of includes/

Bug: T321882
Change-Id: I1844da95d4fd79824646fdf4b6063cb771ca3000
2022-11-08 10:53:27 +01:00
daniel
6fd3a7b0b0 Stash original wikitext when rendering unsaved content.
When visual editor switches from source mode to visual mode, we need to
stash the wikitext. Otherwise, we later lack the proper context to
convert the modified HTML back to wikitext.

Bug: T321862
Change-Id: Id611e6e022bf8d9d774ca1a3a214220ada713285
2022-11-04 17:17:32 +01:00
jenkins-bot
fcf1254593 Merge "PHPUnit: introduce clearHooks() method." 2022-11-04 14:11:49 +00:00
jenkins-bot
5f84c3eac4 Merge "Various doc fixes about false and null on method arguments/return types" 2022-11-04 10:35:19 +00:00
jenkins-bot
59ab57573d Merge "objectcache: add "segmentable" option to WANObjectCache" 2022-11-04 00:32:21 +00:00
jenkins-bot
e1d7753b53 Merge "rdbms: simplify getLagFromPtHeartbeat() in DatabaseMysqlBase" 2022-11-04 00:27:17 +00:00
Aaron Schulz
b24871a15c objectcache: add "segmentable" option to WANObjectCache
This allows for large string value storage similar to that
of direct BagOStuff callers.

Bug: T309126
Change-Id: I22d2d8bb520ef2ea6ccd28016d34db36fe27c3df
2022-11-04 00:12:44 +00:00
Umherirrender
1b342a8893 Various doc fixes about false and null on method arguments/return types
Doc-only changes

Change-Id: Ice974b3ba41708859dfe646e94b31c5ebbf26410
2022-11-03 18:55:47 +01:00
daniel
8e0ae53482 PHPUnit: introduce clearHooks() method.
Since the introduction of the new hooks stystem, it is not possible to
clear all hooks by setting $wgHooks. This would only clear old-style
hooks. This is becoming increasingly problematic as the new hooks system
is adopted by more and more extensions.

Introduce a method that allows tests to reset many or all hooks.
This isn't needed much in core, but extension tests need it.

Change-Id: Ica3eb88fe23fe822d2aadb96ff5d15f80dce0d7b
2022-11-03 13:40:42 +01:00
jenkins-bot
1005ba3be8 Merge "Use buildComparison() instead of raw SQL in WatchedItemQueryService" 2022-11-02 10:11:41 +00:00
Aaron Schulz
85eb9b3e66 rdbms: simplify getLagFromPtHeartbeat() in DatabaseMysqlBase
Avoid expensive SHOW query for sites that were explicitly configured
to use pt-heartbeat but configured without a row SELECT condition.

Reduce excessive code complexity for configuration edge cases.
Remove getLagDetectionMethod() and just use the field instead.

Change-Id: I0d8592fde65d8a143506c55dccd1972a148bd489
2022-11-01 21:33:05 -07:00
jenkins-bot
3a61bdbd43 Merge "objectcache: split out WANObjectCache::setMainValue() helper method" 2022-11-01 23:55:47 +00:00
Aaron Schulz
a454105b48 objectcache: split out WANObjectCache::setMainValue() helper method
Make set() and getWithSetCallback() wrap setMainValue(), avoiding some
duplicate option array resolution logic.

Track set() calls via statsd, now that it can be distinguished from
getWithSetCallback() invocations.

Change-Id: Ia1e7b244b1db3b76314d718b3aea9e6e708235c0
2022-11-01 15:53:48 -07:00
jenkins-bot
857a998f65 Merge "Reorg: Move some of request related classes to MediaWiki/Request" 2022-10-31 23:10:30 +00:00
jenkins-bot
ff47027005 Merge "tests: Replace checkPHPExtension() with @requires annotations" 2022-10-28 13:25:10 +00:00