Commit graph

11824 commits

Author SHA1 Message Date
Dan Duvall
9778adf1c5 Refactor SettingsBuilder to use BagOStuff.
Removed use of Psr\SimpleCache\CacheInterface in favor of BagOStuff, as
the latter is a tried-and-true abstraction and the former offers no real
upfront benefits since the caching patterns of SettingsBuilder are quite
basic at this time.

The simplicity of cache interface use is largely in part to the minimal
probabilistic stampede protection implementation within CachedSource
which is left untouched by this change.

Bug: T294748
Change-Id: Ie59b37a8d5c7bf96225757fa9eb9d2c762476713
2021-12-10 10:20:05 -08:00
Derick Alangi
6aac95eb44 Settings: Introduce PhpSettingsSource for provisioning settings
This is an intermediate step before converting the merge strategies or
other configs/config schemas to YAML.

Bug: T297320
Change-Id: I91cd04d14f0ff86125fc8870984dab045c2098b5
2021-12-09 20:35:32 +00:00
jenkins-bot
4c5102cc28 Merge "tests: Add structure test for bundlesize.config.json" 2021-12-09 09:42:41 +00:00
Tim Starling
9496e37ac7 Additional tests for LinksUpdate and LinksDeletionUpdate
Each table at least needs an added, deleted and unmodified link in order
to fully exercise the incremental update code.

Disable INSERT IGNORE during testing, since this can hide an omitted
delete query.

Change-Id: Iaa9f32ea5171da4f983379d7ff313bfdf1cb0b2f
2021-12-09 12:32:06 +11:00
jenkins-bot
7a554d38d6 Merge "Add IDatabase::factorConds()" 2021-12-08 23:10:57 +00:00
jenkins-bot
b258c6da9a Merge "Upgrade Vue to the migration build of Vue 3" 2021-12-08 20:12:51 +00:00
jenkins-bot
87d0b612de Merge "Allow DeleteLogFormatter to work with pre-T20361 (April 2009) log rows" 2021-12-08 16:12:01 +00:00
Tim Starling
4ba64a1967 Add IDatabase::factorConds()
Generalize makeWhere2d() to provide factorConds(), which simplifies any
boolean expression consisting of equality conditions in a
sum-of-products form.

Change-Id: Ic2d6b054b69fd0be0577807bcc4afb919af7d693
2021-12-08 11:02:46 +11:00
Roan Kattouw
5bd107c968 Upgrade Vue to the migration build of Vue 3
* Upgrade Vue to @vue/compat version 3.2.23
* Migrate Vue.createMwApp to Vue 3 API
* Add backwards-compatible wrapper emulating Vue 2 behavior for
  new Vue( { el: '#foo', ... } ) and
  new Vue( ... ).$mount( '#foo' )
* Make @vue/composition-api an alias for vue, for b/c
* Convert resources/src/vue/ to ES6
* Ignore resource/src/vue/ for jsduck, since it doesn't support ES6
* VueComponentParser: Remove check for only one root node

Bug: T251974
Co-Authored-By: Lucas Werkmeister <lucas.werkmeister@wikimedia.de>
Depends-On: Ica0c0d0d6247383796d39199e50a9aff917f5b53
Change-Id: Ibd618765f962f57984994604c61b1aff9e6a778d
2021-12-07 19:31:43 +00:00
jenkins-bot
d70cf2d455 Merge "SettingsBuilder: load skins and extensions" 2021-12-07 17:22:42 +00:00
daniel
ffc247d417 SettingsBuilder: load skins and extensions
This is a minimal baseline implementation that allows skins and
extensions to be loaded from settings files.

This should be improved by closely integrating SettingsBuilder with
ExtensionRegistry. They should probably end up being the same thing
eventually. Loading extension.json is essentially the same as loading
settings files.

Change-Id: I02a1d9b517815463f150b53c0602927609ff9eeb
2021-12-07 17:25:58 +01:00
jenkins-bot
f7a8108f63 Merge "Drop pr_user from page_restrictions" 2021-12-07 11:28:57 +00:00
jenkins-bot
d0507a2740 Merge "Use hasVariant in loop to determine parent language in LanguageFactory" 2021-12-07 00:03:05 +00:00
jenkins-bot
b085cd60cf Merge "Change return format of DeletePage again" 2021-12-06 22:20:15 +00:00
jenkins-bot
ac553b8d3f Merge "Settings: Prevent applying more settings after invoking ->finalize()" 2021-12-06 21:47:14 +00:00
Kosta Harlan
415409fb75 phpunit: Set config for SkinMustacheTest
Depends-On: I72d873d05c376c3a04ebf6b670f6b90c1585b4fe
Bug: T297103
Change-Id: I67fa885a40d2e2cdb8831065ae9e15413ac0076f
2021-12-06 17:15:37 +01:00
Kosta Harlan
a8f9ede5fe ArticleViewTest: Set wgTitle for test
Bug: T297102
Change-Id: I032cc9d268fc8241e68535206409bfb5ffba732d
2021-12-06 17:15:37 +01:00
jenkins-bot
9067834479 Merge "phpunit: Mock session object for user in DefaultPreferencesFactoryTest" 2021-12-06 14:15:19 +00:00
Func
cdd5b4db86 Use hasVariant in loop to determine parent language in LanguageFactory
Code of some language's parent language can't simply strip out the subcode.
e.g. ike-cans should get iu.

Change-Id: I4cf5bb1ddc463a8d98064451dd8e4dbebeca96e9
2021-12-06 13:52:46 +00:00
Kosta Harlan
67e88c00cc phpunit: Mock session object for user in DefaultPreferencesFactoryTest
Depends-On: I6c7216611ce5ca65eda589a1a07014c9ce007957
Bug: T297082
Change-Id: Ie1ad9cf71129bcadbe1de6cd82f2662998941ba1
2021-12-06 08:44:50 -05:00
Amir Sarabadani
ede308ed55 Drop pr_user from page_restrictions
It's not used for 13 years, safe to say it won't be used anytime soon

Bug: T199377
Change-Id: Iecf4fb6046699a1758ad2d1dc55a3ee8eb4b0389
2021-12-06 14:15:39 +01:00
jenkins-bot
3bd43506dd Merge "phpunit: Use submap assertion for LanguageIntegrationTest" 2021-12-06 12:28:12 +00:00
jenkins-bot
3e8a8d7c1a Merge "Remove the MediaWikiTestCase class alias" 2021-12-06 12:07:04 +00:00
Kosta Harlan
d55dc6d953 phpunit: Use submap assertion for LanguageIntegrationTest
LanguageIntegrationTest asserts strict equality for namespaces, but
other extensions which add to namespaces are not accounted for. This
seems to work OK when LanguageIntegrationTest is run alongside all other
PHPUnit tests but causes failures when run on its own (see console
output in T297078).

Asserting the submap should be sufficient for this test, AIUI.

Bug: T297079
Change-Id: I708c79f452a3eede1bae1422f27160a32db0e4dd
2021-12-06 10:02:18 +01:00
jenkins-bot
f2295991b9 Merge "Use LanguageNameUtils constants instead of strings" 2021-12-05 22:00:29 +00:00
Alexander Vorwerk
3aa5b6643b Use LanguageNameUtils constants instead of strings
Change-Id: I8521d00675008da0d7c8c768ab75352212653c66
2021-12-05 22:13:34 +01:00
jenkins-bot
fb2fc3152a Merge "Replace deprecated Language::fetchLanguageNames" 2021-12-05 20:58:09 +00:00
Umherirrender
3f08cd753a Replace deprecated Language::fetchLanguageNames
Change-Id: Iecd5481edb4dae6c7911157e24c32a51f4438ab2
2021-12-05 21:11:49 +01:00
Alexander Vorwerk
bf56204a44 Remove the MediaWikiTestCase class alias
Bug: T293043
Depends-On: I53852a255ceeab8083d0f5354949929df6c55b96
Change-Id: I477c0dfcb7bbb53a9972ce6b48acb470118c1ace
2021-12-05 13:50:40 +00:00
jenkins-bot
c924a24be2 Merge "Support having groups inherit permissions from another group" 2021-12-05 11:18:37 +00:00
Kunal Mehta
6f01b0d007 Support having groups inherit permissions from another group
There are common use cases to having a group inherit permissions from
another group. For example, if you have to have a "confirmed" group that
can be manually handed out to grant "autoconfirmed" status, or if you
wanted to make the "sysop" group also have "interface-admin" powers.

Previously to make this work you needed to either copy all the
$wgGroupPermission entries for the second group, or use a
$wgExtensionFunctions to copy it over at runtime. Neither are great
solutions, hence this patch.

This introduces a new configuration option, $wgGroupInheritsPermissions,
that GroupPermissionsLookup will use when determining what permissions
each group has. This option is not recursive for simplicity.

To make this work, Special:ListGroupRights now consults
GroupPermissionsLookup instead of looking at the
$wgGroupPermissions/$wgRevokePermissions globals. It also uses
UserGroupManager to get the list of all groups instead of looking at
more globals.

Anything still directly reading permissions from those globals is liable
to be broken, if they weren't already.

Bug: T275334
Change-Id: Iad72e126d2708012e1e403bee066b3017c16226d
2021-12-04 12:45:23 -08:00
Umherirrender
7359c6bda9 Allow DeleteLogFormatter to work with pre-T20361 (April 2009) log rows
The i18n part of T20361 / ec0dd5b adds new log parameter,
logs from before the changes are needed to work with the formatter.

Bug: T289806
Change-Id: I096bc14373cbe038671fc33f651af7e005998a3b
2021-12-04 19:45:51 +01:00
jenkins-bot
676747b51f Merge "Revert "tests: Special page constructor are not allow to call getContext"" 2021-12-03 18:43:06 +00:00
Lucas Werkmeister (WMDE)
39f8110385 Revert "tests: Special page constructor are not allow to call getContext"
This reverts commit f2de49b694.

Reason for revert: breaks CI for several other extensions.

Bug: T297020
Change-Id: I20061df89f4727431be84e52e5133fe50412d338
2021-12-03 18:09:03 +00:00
jenkins-bot
39ebbb075d Merge "tests: Special page constructor are not allow to call getContext" 2021-12-03 16:52:11 +00:00
jenkins-bot
04d5785718 Merge "Refactor cache TTL for SettingsBuilder sources" 2021-12-02 20:05:39 +00:00
jenkins-bot
b1bd9eba65 Merge "Tests: Update syntax referencing classes and internal functions" 2021-12-02 19:27:05 +00:00
jenkins-bot
649149881a Merge "Fix type hints in SpecialWatchlistTest" 2021-12-02 18:09:18 +00:00
Dan Duvall
9fb695d75c Refactor cache TTL for SettingsBuilder sources
Move cache TTL from `CachedSource` into the `CacheableSource` interface,
allowing each source to define a TTL most appropriate to its own
settings loading implementation.

Fix bug where `generation` time was computed incorrectly by `CachedSource`.

Include tests to exercise all `CachedSource` interactions with
`CacheInterface` and `CacheableSource`.

Bug: T296771
Change-Id: I97c42cf6ca716516c32104de25245aa21ec110e4
2021-12-02 09:53:46 -08:00
Thiemo Kreuz
d51c0032af Tests: Update syntax referencing classes and internal functions
Change-Id: Icd577d522a24cb636305ea7f1067a4f75816ba34
2021-12-02 17:07:49 +01:00
Thiemo Kreuz
d852f7e193 Fix type hints in SpecialWatchlistTest
Callers expect the specific special page, not just the generic
SpecialPage base class.

Change-Id: Id9b13c382d0731c98e711cb9d6cbd759382d3eea
2021-12-02 16:41:35 +01:00
Derick Alangi
086f4b1c5f Settings: Prevent applying more settings after invoking ->finalize()
When we're done applying settings and we call `finalize()`, any further
attempt to apply settings too late should throw.

This is a defensive mechanism for us to track the state of settings applied
in during setup process and will guide us to bring all settings to be applied
in the appropriate place so unexpected things don't happen.

Bug: T296684
Change-Id: Id58654c8265bc8310e1fe464ff5a480aad8a8666
2021-12-02 11:05:50 +00:00
Derick Alangi
8fe9e0317f Introduce Redirect(Lookup&Store) services to handle redirects
The concept of a redirect chain didn't really work for a value of
max redirect > 1. In the ideal world, we just want to have a source
which points to target (source -> target) discarding the concept of
a redirect chain completely.

Having something like: source -> target -> target1 -> target2 doesn't
really work well with the current database design.

NOTE: Support for $wgMaxRedirect will be removed soon hence
deprecation without interfaces for replacement.

Bug: T290639
Change-Id: I469de6f85e405e8ddbe7abaa5b99b77cb9cf415d
2021-12-01 19:14:22 +01:00
Kosta Harlan
61e16d8ef8 tests: Add structure test for bundlesize.config.json
This is the same functionality provided by `npm test:size` in Minerva
and Vector skins, but as a structure test. Any extension/skin that
provides bundlesize.config.json containing an array of expected gzipped
sizes and module names will be processed by this test.

See also WikimediaMaintenance's blameStartupRegistry.php for similar
code.

Bug: T255149
Change-Id: Ieb7591f3c0ac843677a2a61b4ad47f920fc2ca2d
2021-12-01 14:12:33 +01:00
Aaron Schulz
b1ab76471f edit: Make PreparedEdit->timestamp lazy to avoid eager parse
Avoid triggering a parse in DerivedPageDataUpdater::getPreparedEdit().

Defer the internal getOutput() call till when something actually tries
to access the timestamp property.

Bug: T277788
Change-Id: I899d9966214b36ebcd660aaf7c2da399e35be92e
2021-12-01 12:34:36 +00:00
jenkins-bot
73f4932190 Merge "Re-add PHPUnit start/end log messages" 2021-12-01 12:09:10 +00:00
Petr Pchelko
2932c3c92f GlobalConfigSink: don't double-prefix in setDefault
$this->set was calling the overridden method, so if it was
called from setDefault, we'd end up double-prefixing the config.

Change-Id: I5f912332cc69cb58bb71e87cd9f8154246b53232
2021-11-30 14:03:11 +00:00
Petr Pchelko
f98f7312e1 SettingsBuilder: add ability to validate config against schema
Not yet sure if config validation makes sense in production,
possibly before we write into cache we can validate, and then
trust that the cached values are all valid. This patch just
adds ability to validate the configuration.

"justinrainbow/json-schema" is already a transitive dependency
and is already in vendor.

Change-Id: Ib039c897a36a7e1911309fd29514657042b1b139
2021-11-30 00:09:07 +00:00
jenkins-bot
8c63af50dd Merge "Cache loading of SettingsBuilder sources" 2021-11-29 22:12:39 +00:00
jenkins-bot
0aef7a462b Merge "Hard deprecate TitleFactory::newFromIDs and Title::newFromIDs" 2021-11-29 21:28:11 +00:00