Commit graph

118 commits

Author SHA1 Message Date
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
Matthias Mullie
c6a92ce891 Add default value for search-thumbnail-extra-namespaces
Bug: T320337
Change-Id: I7f891e804d20cc2c80844148585fa5ecf22446aa
2022-10-18 11:36:50 +02: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
Derick Alangi
0ec96651f7 ServiceWiring: Remove backcompat code and kill $wgShellboxUrl
https://codesearch.wmcloud.org/search/?q=ShellboxUrl&i=nope&files=&excludeFiles=&repos=
shows that this is indeed not used and should have been removed by
1.38

Change-Id: I23cc10e4838050e20c24922145e551f3c070ff2f
2022-10-05 11:45:54 +00:00
jenkins-bot
8562736102 Merge "Use OpenSSL if available for PBKDF2 password hashing" 2022-10-05 00:05:24 +00:00
Kevin Israel
47241a3520 Use OpenSSL if available for PBKDF2 password hashing
This at least doubles the speed, which would allow the number of
iterations to be doubled and computation of the password hash to
complete in the same amount of time as before, or maybe even a
slight bit less.

The doubling in speed is due to an optimization[1] that so far has not
been accepted into PHP's hash extension.[2] In addition, OpenSSL has
optimized assembly-language hash function implementations for several
common CPU architectures. These provide a further, yet more slight,
performance improvement.

While OpenSSL's PKCS5_PBKDF2_HMAC() is not the fastest implementation
around, using it does not add a new library dependency. And although
better password hashing functions exist, PBKDF2 is still the default
in MediaWiki. For these reasons, I think this change makes sense.

[1]: https://github.com/openssl/openssl/commit/c10e3f0cffb3820d
[2]: https://github.com/php/php-src/issues/9604

Change-Id: I7b06590d4c42581f8749336f9c17777f973a506c
2022-10-04 19:46:14 -04:00
Moh'd Khier Abualruz
6d6c8db99c The Special:Contributions page should show tabs to Special:Contribute
Follow up to
- I7f064a954a77373dfec86efae7e378402f500198
- Iac34777a89e3e6732a0916dbf0a22677cbc6d121

Bug: T319240
Change-Id: I90f943744d2ca0d384a3b378dce473b9f1edafb6
2022-10-04 23:04:49 +00:00
Matthias Mullie
c4a36b0023 Introduce SearchResultThumbnailProvider & move hook + NS_FILE thumbs in
What was previously a REST API-only feature (the thumbnails
hook allowing for thumbnails for non-file pages via the
PageImages extension) is now also being adopted in the main
search page.

That hook will now be called with NS_FILE result thumbnails
pre-filled, which was not the case previously. PageImages
essentially duplicated NS_FILE thumbnail logic that was
already present in Special:Search, so that can (and will
in a follow-up patch) then be removed there. Special:Search
will then simply take whatever is produced from the provider
(which will include both NS_FILE thumbs - which it handled
already - as well as whatever else it receives from the hook),
as will the REST API (which already received both)

Since thumbnails can now come in for multiple namespaces &
having some of those results with & others without a thumbnail
can be quite jarring, it was decided that we'd display
placeholder images (for certain namespaces). This is now
controlled by $wgThumbnailNamespaces.

I also split up a few things in FullSearchResultWidget::
generateFileHtml for more clarity.

Meanwhile also updated mediawiki.special.search.styles.less
to use variables for known colors.

Also implemented a 'transform' (required for testing this
change properly) and 'getDisplayWidthHeight' (it became
needed after implementing transform) callback function for
mock Files, and updated some existing tests in response to
these changes.

And some more Rest test files have been updated to allow
passing around a HookContainer instead of only an array of
hooks (from which a new HookContainer would then be created)
to allow the same container to be used across all relevant
objects, who may have it injected as dependency.

Bug: T306883
Change-Id: I2a679b51758020d3e822da01a1bde1ae632b0b0a
2022-10-03 10:52:50 +00:00
jenkins-bot
d65fe42169 Merge "wgPasswordPolicy: Raise default password length for basic users to 8 characters" 2022-10-01 04:45:20 +00:00
jenkins-bot
ca44e87f00 Merge "jobqueue: Remove unused EnqueueJob class" 2022-09-29 18:19:04 +00:00
Timo Tijhof
4ecfa8e11d jobqueue: Remove unused EnqueueJob class
This was introduced in 2015 with 8e3721a2b9 (Iadb34f24d8b, T89308)
as part of the Multi-DC initiative, with the plan being to use this
job when queueng jobs during a requests that are not guruanteed to
be routed to a primary DC (e.g. during a GET request).

Its use was removed as part of T181216, but the job was kept and has
seen numerous maintenance changes since. I propose we remove it as it
is no longer used in any Wikimedia Gerrit hosted code.

The expectation now is that JobQueue backends are responsible for
making sure new jobs can be accepted in any DC. At WMF this happens
by writing to local EventBus/Kafka and the internal streams converging
and mirroring in both directions.

The built-in JobQueueDB implementation is unlikely to be used in for
large wiki farms, but it too would support writes from secondary DCs
from post-send. I haven't tested JobQueueRedis, but it seems like that
could likely also be used in a way that writes locally and replicates
writes from secondary to primary.

Bug: T89308
Change-Id: Ia84d0e9ca047cd78ab8c0d0d055d4199d0e3e5b6
2022-09-28 16:10:01 +01:00
James D. Forrester
2368233e2f wgPasswordPolicy: Raise default password length for basic users to 8 characters
This policy was just the fall-back set in 2015 with the default length
of 1. As pointed out on MediaWiki-l, it is a bit short nowadays, so
raise it to 8 characters, which is what we use in Wikimedia production.

Change-Id: I4e0e57ed910a16804e015c9f1aaf48a5603bf95f
2022-09-27 22:10:16 +00:00
Timo Tijhof
0ba2242300 interwiki: Remove outdated CDB references
* CDB stands for "constant database" file, hence also changes references
  to "constant" when likely intended to refer to CDB.

* Remove reference to non-existent docs/Configuration.md.

* Remove unused resetLocalCache() method. This was documented as
  internal for testing only, but tests did not use it.
  It was left behind in 2016 with I7d7424345d0ce3ce90 (025f15a208).

Bug: T315315
Change-Id: I61d9689160d9bf5715c4ff18009fbd16236d34e6
2022-09-23 16:41:08 +01:00
jenkins-bot
f997d67c93 Merge "Fix docs for InterwikiCache about .cdb files" 2022-09-19 23:52:22 +00:00
Jsn.sherman
acb989af2d Revert "Mobile Preferences - display Special:Preferences as a vertical menu"
This reverts commit cfed8e7743.

Reason for revert: Will implement a hook rather than changing config at runtime

Change-Id: I5a941b871f9a6347744e800ea63cd82450ab6da3
2022-09-15 21:37:45 +00:00
suecarmol
cfed8e7743 Mobile Preferences - display Special:Preferences as a vertical menu
This patch changes the Special:Preferences menu layout to display as a vertical menu. This function will only work for users with AMC enabled.

It also creates a variable (SpecialPreferencesUseMobileLayout) that changes when a user navigates to Special:Preferences on mobile and has AMC enabled.

Bug: T311717
Change-Id: Ia7a730cd7f009dbb921a810f27fae4a9ee66f793
2022-09-15 13:07:50 -05:00
jenkins-bot
379b465663 Merge "ResourceLoader: Remove $wgIncludeLegacyJavaScript and simplify code" 2022-09-12 08:24:23 +00:00
jenkins-bot
0609ace61c Merge "Fix block handling in CheckBlocksSecondaryAuthenticationProvider" 2022-09-12 06:54:17 +00:00
Timo Tijhof
0ff333e2ff ResourceLoader: Remove $wgIncludeLegacyJavaScript and simplify code
When the deprecation of wikibits.js originally started, it contained
a ton of things [1] such as:

* user-agent utils, `clientPC` and `is_gecko`.
* addOnloadHook.
* importScript.
* appendCSS.
* stylepath and other config vars.
* tooltip, e.g. updateTooltipAccessKeys.
* portlet, addPortletLink.
* tablesorter, e.g. ts_makeSortable, ts_getInnerText
* searchsuggest.
* notify utils, e.g. jsMsg.
* spinner utils, e.g. injectSpinner.
* event utils, e.g. hookEvent.
* siblings scripts included: mwsuggest, sajax.

Except for two (addOnloadHook, and importScript), these have all found
new homes and been succesfully migrated and replaced over the years
with other platform APIs.

The $wgIncludeLegacyJavaScript variable hasn't been needed for a while
as what it gated no longer exits. Remove it and fold the two remaining
functions into mediawiki.base as defacto stable APIs.

* addOnloadHook: Not worth breaking imho. I've shortened the
  implementation which saves a few bytes in WMF prod, and adds a few
  bytes for CI/third-party where it was previously absent for new
  wikis (thus reducing portability).

* importScript: Never deprecated in the first place as there is no
  mw.loader equivalent to this. In order to achieve optimal cache
  performance, and benefit from automatic purging after edits, one
  must craft a very specificly encoded and ordered canonical
  action=raw URL. This is not something end-users need to know about,
  and is what imporScript exists for to abstract. Plus, it ensures
  de-duplication. One day something like Gadgets 3.0 (T36958) might
  take off, but for many years to come, importScript remains the best
  and only supported and usable means within the platform to share
  and load user scripts.

Tested with: `curl 'http://localhost:8080/w/load.php?modules=mediawiki.String%2Cbase%2Cuser%2Cutil&skin=vector' | gzip -9 | wc -c`.

Before: 9.53KB
After: 9.45KB

[1] https://gerrit.wikimedia.org/g/mediawiki/core/+/1.17.0/skins/common/wikibits.js
[2] https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)

Change-Id: I10f17f68fea862d510d188b927f4a7b38be0e4a4
2022-09-11 16:52:07 +02:00
Timo Tijhof
372f49676a OutputPage: Fix undefined ['host'] in ImagePreconnect code
Instead of checking the result of uncondiional `['host']` access in
the foreach loop afterward, check the result of url parsing directly.

Also:

* Switch to plain parse_url(), we don't support exotic input here.
* Move parsing to loop, minor optimisation, and will often thus mean
  we don't even need to parse or check the LocalRepo case, since the
  feature is generally only enabled when a cross-domain ForeignRepo
  exists.

* Improve docs.

* Remove experimental warning.

Bug: T317329
Change-Id: I6492f5142861513e4a7eb65fe4c14fa12c46977a
2022-09-08 19:24:08 +02:00
jenkins-bot
92e8310168 Merge "Add "1 year" to watchlist expiry" 2022-09-08 02:21:10 +00:00
Umherirrender
5e748ef269 Fix docs for InterwikiCache about .cdb files
The merge of the addition of the new file e36a8af and the creation of
the first patch for removal in the old file b90d2dd overlaps by time and
the information is still there.

Follow-Up: I736cb74efc267fd2473a3267471735238217251c
Change-Id: I6de1e6874206d8a9c7b207b6322d77f6472d22f5
2022-09-06 21:57:18 +02:00
Amir Sarabadani
6c4194e23e schema: Drop tl_title and tl_namespace fields from templatelinks
The day has gone. Still keeping the code as the schema changes are not
done in production but the data migration has been finished.

Bug: T299417
Change-Id: I906e069a63d1dae14924c72318b22b16244371d6
2022-09-06 19:53:15 +02:00
Gergő Tisza
04bdfa50f0
Fix block handling in CheckBlocksSecondaryAuthenticationProvider
The authentication provider's testUserForCreation() method is for
checking whether a given user name is available. The current
user being IP-blocked has nothing to do with that username's
availability so stop checking that. (AuthManager will check it
via AuthManager::authorizeCreateAccount() elsewhere. Although
that method doesn't seem to be doing anything useful and could
probably just be replaced with a direct call to
PermissionManager, but that's left for a separate, less risky
patch.)

Special-case autocreation though, which doesn't use
the more appropiate AuthManager::authorizeCreateAccount() for
performance reasons so it does need an IP block check.
(At least I think it is for performance reasons. Maybe it's
just an unintentional omission, and that should be used instead?)

While we are at it, also fix a TODO in AuthManager where partial
blocks were taken into account for $wgBlockDisablesLogin, and
clarify in the config schema that they aren't, improve some
comments to make it more obvious why some things are/aren't
done in CheckBlocksSecondaryAuthenticationProvider, and make
the logic more similar to the one in testUserForCreation().

Functional changes:
* Partial blocks are ignored for authentication, account
  creation and autocreation.
* On $wgBlockDisablesLogin wikis IP blocks won't prevent
  login anymore.
* On $wgBlockDisablesLogin wikis, blocks will now prevent
  account autocreation even if they are not configured to
  prevent account creation. The assumption is that on such
  wikis account creation is restricted via some means.
  This probably isn't necessary as blocks should also prevent
  the conditions needed for autocreation (e.g. log the user
  out centrally), but can serve as defense in depth.
  Along with the special-casing of autocreation, this means
  on such wikis any IP block will prevent autocreation, which
  is not great but seems not worth even more code complexity
  to avoid.
* The action=query&list=users&usprop=cancreate API won't take
  blocks into account anymore.

Bug: T306018
Bug: T208895
Change-Id: Ie94d61640301192b287275311f3452e606469d25
2022-08-30 19:06:16 -07:00
R4356th
2cd7e5aabb OutputPage: replace legacy link type "shortcut icon" with standard
Bug: T19980
Change-Id: I6ed3417fc9efa9bab9533f155dcfe23a78d19e3b
2022-08-19 18:04:24 +06:00
Lucas Werkmeister
434d99bbf9 Remove experimental warning from MultiShardSiteStats
We’ve been using it in production for two months without issues as far
as I’m aware, so let’s start documenting it as a more permanent feature.
(After all, people querying the table, e.g. via Quarry, need to be aware
of it.)

Bug: T306589
Change-Id: I66d405b34f02c57a337d196124c0d5a4d3a3b20b
2022-08-13 14:21:13 +00:00
NovemLinguae
aad407bb3e Add "1 year" to watchlist expiry
When $wgWatchlistExpiry = true and a user adds a page to their
watchlist, they are currently presented with a combo box where they can
pick a duration of permanent, 1 week, 1 month, 3 months, and 6 months.

This patch adds 1 year to the combo box, and raises the maximum age to 1
year. `api.php?action=watch&expiry=1 year` will now also work.

Bug: T313255
Change-Id: Ia84d6f99584ae23feea3831499d5baee2dd1a024
2022-08-13 00:50:05 -04:00
Ori Livneh
a87177564a Support CDN query parameter re-ordering
MediaWiki sets a large 'Cache-Control: s-maxage=' directive on page
views only if the request URL matches one of the normal CDN URL forms.
When MediaWiki is behind a CDN that re-orders query parameters on
request URLs, we want the CDN URL matching logic to be insensitive to
the order of query parameters. This change introduces a
'CdnMatchParameterOrder' configuration option that can be used to
control this behavior. It defaults to 'true', which preserves the
existing behavior (order-dependent matching).

Bug: T138093
Change-Id: I3c52ca47e095ba32511892853dac6c87a1cc2321
2022-08-09 01:53:38 +00:00
jenkins-bot
8f923868c5 Merge "Skin: Remove schema leftover for removed $wgFooterLinkCacheExpiry" 2022-08-03 20:10:44 +00:00
Timo Tijhof
ed94214c4f objectcache: Remove unused WRITE_SYNC flag
Bug: T270225
Depends-On: I7e72c1180b7ba9e479ade62ab3dd3139d7bd5bb0
Change-Id: I9f59ff35bbb806d7b1375739001d1cf458f366a8
2022-08-02 17:05:26 -07:00
Timo Tijhof
3e682f7280 Skin: Remove schema leftover for removed $wgFooterLinkCacheExpiry
Follows-up 1fa903a211 (I581c49839ab4).

Bug: T313462
Change-Id: Id2c7043fb89d59026dacefbdf1599e6cbf9ef418
2022-08-02 01:48:38 -07:00
jenkins-bot
8df1a4c135 Merge "Use ParserOptions::setSuppressTOC() for Javascript content" 2022-07-27 08:24:37 +00:00
Tim Starling
51ddd70682 Remove Flash cross-domain policy mangling
Remove Flash cross-domain policy mangling. Users who are somehow still
using Flash as a browser extension will be exposed to CSRF
vulnerabilities.

Deprecate the config since deprecation has some advantages in the new
config system over simple removal.

Bug: T279496
Change-Id: I2c0e85a430d7e6aaf8d5decd00cf1dade04cebe1
2022-07-22 11:44:49 +10:00
C. Scott Ananian
ccd0ee2f39 Use ParserOptions::setSuppressTOC() for Javascript content
This ensures we don't show ToCs in vector-2022 for Javascript pages
which contain raw <h2> elements.

This version uses the same "canonical options" hack that is used for
language conversion tables.  These should both be replaced by a
(not yet existing) mechanism in the future: T313455 is the
task for that.

Bug: T307691
Depends-On: I35e199cca40c0e4359ac493e5806dcf4ae49321c
Change-Id: Iba6a8b6c59bf91e3d06896f0a610c3c3e52e6564
2022-07-21 15:29:16 -04:00
daniel
e8cc4c8f91 Fix type declarations in MainConfigSchema
Validating against the live schema on the WMF cluster exposed several
issues with the config schema. Mostly settings declared to be lists
which are actually associative arrays.

This also removes deprecation markers for some settings that are still
in active use, just discouraged or unstable.

Change-Id: I63e816edd1a561bda6063f8558ccce88c113df3f
2022-07-15 16:11:50 +02:00
jenkins-bot
f16784cc54 Merge "SettingsBuilder: report warnings" 2022-07-15 12:34:03 +00:00
daniel
cf39a40f16 SettingsBuilder: report warnings
This adds functionality to SettingsBuilder for collecting warnings to be
logged later, when the logging mechanism has been set up.

This also adds a validation step to update.php that aborts the update
if any warnings have been registered in SettingsBuilder, or the settings
fail to validate against the settings schema.

Change-Id: I387905289fb93591f79b96bf4c6cb5ec692b2aff
2022-07-15 12:24:20 +02:00
Timo Tijhof
68d4fe68b9 tests: Remove intermediary suites concept from /tests/qunit
I don't recall why I added this. Possibly in a confused effort
to match /tests/phpunit, except /tests/phpunit/suites is not
where test cases live, they live under /tests/phpunit/* directly,
mostly /tests/phpunit/includes named after the source directory.
The correct equivalent to that is /tests/qunit/resources for JS.

While at it, also remove mention of this concept from various other
places where it doesn't add value. It's one more word/concept to
learn, process, understand, or translate mentally. They're just tests,
or for the one or two places where we care about how they are
internally transmitted, a "test module".

Bug: T250045
Change-Id: I5ea22e4965d190357aa69883f29f9049ee8ebf13
2022-07-13 01:52:57 +00:00
jenkins-bot
3fc9cf4f51 Merge "Add support for write new for templatelinks migration" 2022-07-12 14:17:52 +00:00
Amir Sarabadani
692dde00df Add support for write new for templatelinks migration
- schema change to allow tl_namespace and tl_title being empty
   This is done by removing them from primary key. They don't need to be
   nullable as they have default value.
 - Make sure with WRITE_NEW, updater avoids writing to the old columns

Bug: T306674
Change-Id: I2b8a29043e952060e7a79b6a7a3d647d48cd16fb
2022-07-12 14:46:54 +02:00
daniel
5e928f39e8 Dynamic defaults: fix $wgLocaltimezone being empty
Apparently, $wgLocaltimezone is set to the empty string in many
existing LocalSettings.php file, presumably because the installer
failed to detect the correct time zone.

The new code for handling automatic defaults will only trigger if
$wgLocaltimezone is null, not when it is otherwise empty.

This adds fallback code in strategic places to ensure that the empty
string is handled correctly.

Bug: T305093
Change-Id: I39226466f2bb6a36823ae9032fc62f981eabc64a
2022-07-09 18:59:32 +02:00
Aryeh Gregor
b72b9a8c43 Move dynamic defaults into MainConfigSchema
The goal is to keep the actual default values for settings in the same
place as the setting is declared, and applied using the regular means
for loading the settings -- not in a separate piece of code that needs
to be loaded through some entirely different mechanism.

SetupDynamicConfig.php now contains a few categories of things:

* Post-processing of configuration settings, where already-set settings
  are altered. This could be moved to MainConfigSchema too as a separate
  set of methods.
* Processing of old aliases of settings (blacklist, slave) that are not
  registered as settings anymore and therefore are not available to
  MainConfigSchema. This could perhaps be moved to LocalSettings
  processing somehow?
* Setting $wgUseEnotif, which is also not registered as a setting.
  Easiest would be just to declare it as a setting and have it set
  unconditionally.
* Setting the actual timezone to $wgLocaltimezone. This is not related
  to configuration and should just be in Setup.php.

Bug: T305093
Change-Id: Ia5c23b52dbbfcb3d07ffcf5d3b7f2d7befba2a26
2022-07-07 09:55:48 +10:00
Lucas Werkmeister
c3c5b6c1b4 Remove 'ignoreKeys' from config schema
Unused since change I88754b52c2 (commit 9e95539fc9) – this was only used
for SessionProviders, which is now a map/object instead.

Change-Id: I8da686e6379eb33a63799874fb44f9b0030ab5ba
2022-07-06 10:46:58 +02:00
Lucas Werkmeister
9e95539fc9 Fix config type of SessionProviders
Bug: T307769
Change-Id: I88754b52c2fa69b6777ce6bee3825bfe97394e48
2022-07-05 15:42:35 +02:00
Tim Starling
bcbfc9ccfc Introduce new WRStats library for write-read stats
A library for storage of counter value time series statistics, based
around the observation that memcached getMulti() is apparently fast
enough to do this in a simple manner, with incremented values stored
in time window buckets.

Bug: T310662
Change-Id: I26b1cdba0a06ad16ad8bb71b455e1b6180924d17
2022-07-05 10:35:19 +10:00
daniel
f2df03704e Add support for nested property schemas in MainConfigSchema.
This adds support for JSONSchema style property declarations with nested
schemas. This is a step towards using more nested structured for
configuration, rather than adding to the over 700 keys already defined
in the main config schema.

Defaults from property schemas are aggregated into a default value in
the top level schema. Descriptions are however not yet aggregated.

Change-Id: Iaf46a9ecc83bee3566098c56137a1be66bff2ab9
2022-06-29 16:34:43 +10:00
Derick Alangi
1854fb02d9 Storage: Warm parsoid parser cache with parsoid outputs
This patch introduces a ParsoidOutputAccess service for
getting parsoid outputs and warms the cache with pregenerated
outputs.

It also introduces a config variable in ParsoidCacheConfig that
is turned off by default for controlling the cache warming.

Bug: T301371
Change-Id: I6152c42ea765d94093d8d62598b1b4278314adec
2022-06-28 09:05:41 +00:00