Commit graph

1556 commits

Author SHA1 Message Date
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
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
thiemowmde
6208f68751 Relax ReleaseNotesTest to accept long URLs
Needed-For: I1f085532ab720265acb1213f33869f759a987d92
Change-Id: Icb09fed4cd6d0306ce081b0ea1ca63ef55c4ad25
2022-11-07 13:53:49 +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
jenkins-bot
1e2112436b Merge "variant transform: allow input content-language to be a variant" 2022-11-03 15:27:59 +00: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
daniel
4ad9c9b035 variant transform: allow input content-language to be a variant
When submitting HTML to transform/html/to/html, the language specified
by the input's content-language header should be allowed to be the
source variant.

It should also be possible to just specify the source variant, and
derive the base language from that rather than the content-language
header or the page language.

Change-Id: I703c112358a921a8b0c9e63b70fd820ae3ea16fc
2022-11-02 01:30:36 -04: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
Amir Sarabadani
bbe704b5c1 Reorg: Move some of request related classes to MediaWiki/Request
Redoing I5ea70120d74 but without moving WebRequest that caused issues
with phan-taint-plugin.

Moving:
 - DerivativeRequest
 - FauxRequest
 - FauxRequestUpload
 - PathRouter
 - WebRequestUpload

Bug: T321882
Change-Id: I832b133aaf61ee9f6190b0227d2f3de99bd1717b
2022-10-28 10:15:31 +00:00
jenkins-bot
3d54b16d8a Merge "DatabaseSQLTest: remove unused variable" 2022-10-28 09:57:52 +00:00
Tim Starling
8983047203 DatabaseSQLTest: remove unused variable
Change-Id: I3087387bb4038df08f0738a756b0608eff8e3133
2022-10-28 13:17:22 +11:00
Zabe
f6b9381d7f Revert "Reorg: Move some of request related classes to MediaWiki/Request"
This reverts commit 2bdc0b2b72.

Reason for revert: T166010#8349431

Bug: T166010
Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
2022-10-27 13:14:16 +00:00
Amir Sarabadani
2bdc0b2b72 Reorg: Move some of request related classes to MediaWiki/Request
Moving:
 - DerivativeRequest
 - FauxRequest
 - FauxRequestUpload
 - PathRouter
 - WebRequest
 - WebRequestUpload

Bug: T166010
Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
2022-10-26 16:49:10 +02:00
Timo Tijhof
1cf6f04768 objectcache: Remove WANObjectCacheReaper feature
Introduced in 2017 with I7f14b9ca2533032 (2e5eb693) but remains
unused at WMF, and disabled by default.

Follows-up I62107789fa (9e49260fc9) which added reap to LinkCache
test cases in 2021.

Change-Id: I0654c29a671467dd6b366f462d1c09b90a273413
2022-10-25 23:09:39 +01:00
Amir Sarabadani
0fff5089ba Reorg: Move StubObject classes in includes to its own directory
Bug: T166010
Change-Id: Idcf0e9dc6e0841e4f132207bce0f96774dad898c
2022-10-25 16:04:48 -04:00
Kevin Israel
0ae29bbb69 tests: Replace checkPHPExtension() with @requires annotations
PHPUnit 3.7.0 was the first version to support @requires extension. At
the time checkPHPExtension() was added in a7901801b4, MediaWiki
still supported PHPUnit 3.6.7.

MediaWiki now requires intl and xml, so I removed checks for those
extensions rather than converting them to annotations.

checkPHPExtension() is removed without deprecation; it does not appear
to have ever been used (and is not likely to be used) in MW extensions.
This is explicitly permitted under the stable interface policy. Even if
it were not, only tests are affected, and they are supposed to fail
anyway if hard deprecated code is used.

Change-Id: I45f9b4c0e120683103cead916f4d4ef58bd11530
2022-10-23 20:47:14 -04:00
Bartosz Dziewoński
c1e7aa3009 Use buildComparison() instead of raw SQL in WatchedItemQueryService
Bug: T321422
Change-Id: I1c330646cac85e396f95a64addcb0a19bdb6c8b9
2022-10-22 21:42:38 +02:00
jenkins-bot
43830cde86 Merge "Use array_key_first()/array_key_last() in some places" 2022-10-21 21:57:34 +00:00
jenkins-bot
c7110ae098 Merge "ScrambleMappingTest: mark skipped if the extensions are not present" 2022-10-21 19:42:06 +00:00
jenkins-bot
a85966542d Merge "Use short array destructuring instead of list()" 2022-10-21 11:11:06 +00:00
Tim Starling
0077c5da15 Use short array destructuring instead of list()
Introduced in PHP 7.1. Because it's shorter and looks nice.

I used regex replacement.

Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
2022-10-21 15:33:37 +11:00
Tim Starling
1aeccebaf2 Use array_key_first()/array_key_last() in some places
Introduced in PHP 7.3. I used it to replace reset()/end() followed by
key() where the return value of reset() is not captured and internal
pointer iteration is not locally occuring.

I also used it in a couple of places when reset() is absent but
array_key_first() is semantically desired.

Change-Id: I750d3fa71420cbdca5fb00d82ac5ca40821769d4
2022-10-21 15:01:59 +11:00
Tim Starling
43a93d9782 Use the null coalescing assignment operator
Available since PHP 7.4.

Automated search, manual replacement.

Change-Id: Ibb163141526e799bff08cfeb4037b52144bb39fa
2022-10-21 13:26:49 +11:00
Tim Starling
0318d7cd43 ScrambleMappingTest: mark skipped if the extensions are not present
Otherwise the ScrambleMapping constructor throws an exception.

Change-Id: I47a947639e0968bbee4d706ec081e5f7af390f26
2022-10-21 12:26:57 +11:00
jenkins-bot
d2b199c517 Merge "objectcache: Deprecate WANObjectCache::reap() and ::reapCheckKey()" 2022-10-21 00:36:34 +00:00
jenkins-bot
45c3329bb0 Merge "Settings: add support for obsolete config" 2022-10-20 18:22:24 +00:00
jenkins-bot
faaa5a6cab Merge "Feed: Move feed-related classes to Feed/ and namespace them" 2022-10-20 17:47:35 +00:00
Amir Sarabadani
f8bf3687f4 Feed: Move feed-related classes to Feed/ and namespace them
Bug: T166010
Change-Id: Icdbe003e74d2f31b68b575acfa94c09c24d7aed5
2022-10-20 17:25:49 +00:00
C. Scott Ananian
e185a570ae Add efficient LanguageCode::bcp47ToInternal() helper
LanguageFactory::getLanguage() will accept *lowercased* BCP-47 codes, so
this method is equivalent to
  LanguageFactory::getLanguage(strtolower($code))->getCode()
but should be much more efficient in practice.

Change-Id: I180765604d08ed57f655b69dfb32686f0b2a0dce
2022-10-20 10:11:14 -04:00
Timo Tijhof
7a6301e03d objectcache: Deprecate WANObjectCache::reap() and ::reapCheckKey()
Follows-up Ia550ef7fe3 (4d3549ad71) which added reap to NameTableStore
in 2018, which was then (mostly) removed again with I63e61e1ab (2c7e4adcea)
for T198561, except one call was left behind in reloadMap(). I've
changed this to match the existing delete call in acquireId().

To be removed in I0654c29a671467dd6.

Change-Id: I7541c9c6d1ef70d552944aca94cbc4d0f7ec0d5b
2022-10-20 14:56:50 +01:00
Aaron Schulz
c1e1512698 rdbms: improve LoadBalancer connection pool reuse (ii)
Make DBConnRef enforce the DB domain selected during its lifetime
and allow more nested and successive use of the same connection handle
via DBConnRef. This can avoid extra connections in some cases where
getConnection()/getConnectionRef() is used.

Also:
* Reduce the number of connection pools arrays from six to two
* Merge getLocalConnection()/getForeignConnection() into one method
* Expand various related code comments

Since LoadBalancer::getReadOnlyReason() no longer user the local domain
but rather DOMAIN_ANY, it should not result in "USE" errors if the local
domain does not have a database on the server.

This version of the patch removes the unused reuseConnectionInternal()
method (the method was previously added back to the patch by mistake).

Bug: T226595
Change-Id: I62502f4de4f86a54f25be1699c4d1a1c1baee60b
2022-10-18 17:23:44 -07:00
Aaron Schulz
8607105de9 lockmanager: remove MysqlLockManager and DBLockManager
This obscure class could only be used by running file_locks.sql and
customizing $wgLockManagers. It was not worth the overhead of having
to maintain it.

Remove DBLockManager since there are no subclasses now.

Change-Id: Id7e3fde02dfca02271bcec039be5c079de9de830
2022-10-14 17:43:44 -07:00
daniel
bb10b7d528 Settings: add support for obsolete config
This allows config variables to be declared obsolete. Obsolete config
will be omitted from the schema, defaults, name constants, etc. The
purpose of keeping a declaration of obsolete config around is to allow
the updater to warn admins that they are using a config variable that no
longer has any effect, and provide them with a remedy.

The idea is that support for deprecated config can be removed after one
release per the stable interface policy, but the declaration of
obsolete config should be kept for as long as we support updates,
that is, at least two LTS releases.

See https://www.mediawiki.org/wiki/Topic:X4bh4nf3pe2ho5jj for
discussion.

Change-Id: Ia7a00742ea7a5311e820a6a43b11135a3f2a825f
2022-10-14 15:00:43 +02:00
C. Scott Ananian
4cb3957cf0 Remove $wgParserTestFiles, deprecated in MW 1.30
This global variable was replaced by auto-discovery of parser test
files in extensions and is no longer needed (or used).

Change-Id: Ib616e60f36db32ffd8bc69c71a096f23c0a27910
2022-10-13 09:22:22 -04:00
jenkins-bot
6198dc4d00 Merge "Add some helpers to filter properties out of var_dump()" 2022-10-12 16:59:43 +00:00