Commit graph

3560 commits

Author SHA1 Message Date
Kunal Mehta
5312ac5497 http: Add $wgLocalHTTPProxy to set a proxy for local requests
Currently requests to domains listed in $wgLocalVirtualHosts bypass
use of the standard $wgHttpProxy. With WMF's migration to Kubernetes, we
limit outgoing traffic in a much stricter manner, so even internal
requests will need to go over a proxy (e.g. Envoy).

If the domain passes MWHttpRequest::isLocalURL(), then $wgLocalHTTPProxy
will be used if set, otherwise no proxy will be used (current behavior).

Bug: T288848
Change-Id: Ifd0cbab02fa8f14a82ca34ebc7ad95b2be174434
2021-08-19 16:11:21 +00:00
Timo Tijhof
b98cca8872 language: Remove $wgLangObjCacheSize from LanguageFactory
The $wgLangObjCacheSize configuration variable was added in 2012
with commit 121cf60119. From what I could gather, no-one has ever
needed to change its value. Not for any WMF wikis, not for heavy-duty
special-purpose wikis like translatewiki.net, not for any third-parties
that have public configuration files (e.g. Fandom, WikiApiary, Miraheze),
not for developer environments, and not for test suites.

This follows-up 0484ac9e7a, where the implementation changed
from a FIFO array to use MapCacheLRU (which requires a non-zero size)
and thus introduced conditional complexity and code duplication. This
could be simplified by other means, but it seems like we could just
remove it.

Change-Id: I5143e238857f760f2a2ab6f2e0af174872e9cd43
2021-08-01 16:22:34 +01:00
DannyS712
20293e4c99 Add an ActionFactory and start converting to DI
$wgActions used to map string action names to true,
false, a string, a callable, or an object. Now it can also
be an array (that isn't a callable) corresponding to an
ObjectFactory spec for DI.

This patch converts the revisiondelete and rollback actions to
use DI, with the rest to be converted later. The new structure
of $wgActions is fully backwards-compatible.

We don't yet deprecate Action::factory(), ::getActionName(),
and ::exists(), those will be deprecated in a follow-up.

Additionally, we no longer impose a rule that only some
actions can be overridden on a per-article basis via
Article::getActionOverrides().

Bug: T253078
Change-Id: I0fc3c53d671eced1758458f9a0148180b40c6c9b
2021-07-29 01:32:43 +00:00
Derk-Jan Hartman
7b7f3ac563 Disable browser data detection of telephone numbers
Number ranges are common and easily mistaken as telephone numbers by
the data detectors of popular browsers. To link a telephone number,
use the explicit [tel:phonenumber display value] syntax.

If you want to re-enable, set the BrowserFormatDetection configuration
variable to false.

Bug: T256758
Change-Id: I49dff3c084d8c9a66defcdae5a1ffb8f35ba8a93
2021-07-26 09:39:07 +00:00
Petr Pchelko
4f4822119d Convert CentralIdLookup to UserIdentity.
NOTE: this is a backwards incompatible change which will
need to have corresponding changes implemented in CentralAuth
and probably force-merged.

Depends-On: I4c2170a25ea8b1cf5410a4648ebec66a3ab253f3
Depends-On: I612460ec2c6a038b7155b3f38f3261757ba63b4e
Depends-On: I3b91b333753a877aceb177b7d38f9272a044f055
Depends-On: I9ae86c9a5da66d5857fcea9967012c6bbbfc4d45
Depends-On: I4a08af2227d0dfd833e16469df3f76e397dce669
Change-Id: I67bf4f2442269b8aa1002868ede9a71a5ca43a84
2021-07-21 06:18:59 -07:00
jenkins-bot
19b277816a Merge "DefaultSettings.php: Remove obsolete, no-op config variables" 2021-07-14 13:50:34 +00:00
Ammarpad
f90ecdfa81 DefaultSettings.php: Remove obsolete, no-op config variables
$wgShowSQLErrors and $wgShowDBErrorBacktrace have been
deprecated and immediately made no-op since MW 1.32

Change-Id: I655610ac49cb0a836d0c95aa1e6edc087ebf3f4c
2021-07-14 14:30:44 +01:00
Tim Starling
d3d8dc9965 Schema migration for revison_actor_temp table removal
Introduce a new schema migration stage in which rev_actor is used
directly and the revision_actor_temp table is no longer needed. This
becomes the new "new" stage whereas the previous situation is now
termed SCHEMA_COMPAT_TEMP.

Introduce migrateRevisionActorTemp which copies data from
revision_actor_temp to rev_actor. The code is similar to
migrateImageCommentTemp.php except that it doesn't delete from the old
table.

Partial revert of c29909e59f. That change removed direct
references to $wgActorTableSchemaMigrationStage and made queries
involving revision_actor_temp be unconditional. Such changes need to be
reverted to make the use of revision_actor_temp be conditional again.

In ActorMigrationTest, I compacted provideGetJoin() and
provideGetWhere(), removing most of the duplication between expected
values. I gave all the stages a short name, and mostly used the name in
providers.

Bug: T275246
Change-Id: I7498107dd6433ab7de5bf2e7b3fe2aa5e10e345d
2021-07-14 08:29:04 +10:00
Ammarpad
a03354006e Provide preference to make skins responsive
Bug: T285402
Change-Id: I4e567199a92c0492dac0561a5c7844f6c5c239e6
2021-07-01 22:18:27 +01:00
Timo Tijhof
f602a585ad DefaultSettings: Improve $wgUpdateCompatibleMetadata docs
The old description had some grammatical issues, and did not explain
what it influences or when. Namely, that it considered during manual
purges and overall rebuilds/refreshes. (E.g. it does not cause
update something directly on page views, nor does it kick-off a job
that will upgrade all existing files or something like that.)

Change-Id: Ia2d3f17a9f7c05f816004c619eb9ff1ec45b019b
2021-06-30 17:48:27 +00:00
jenkins-bot
1ffb4ae93a Merge "Manual and automatic image metadata reserialization" 2021-06-29 13:12:35 +00:00
Fomafix
356f1b72ef Use IEC prefixes instead of SI prefixes for byte sizes (docs+backend)
This change doesn't change any UI messages.

Bug: T54687
Change-Id: Ia62899a2a6fe8910618c35cd667291e397ddb055
2021-06-28 11:59:09 +01:00
Tim Starling
9251f3c9e3 Manual and automatic image metadata reserialization
* Add automatic splitting of large metadata on upload or refresh. If
  the reserializeMetadata option is enabled, metadata stored with PHP
  serialization will be automatically reserialized to JSON.
* Inject configuration variable $wgUpdateCompatibleMetadata via
  LocalRepo instead of accessing it directly.
* In refreshImageMetadata.php and rebuildImages.php, construct a new
  LocalRepo with config overrides, instead of overwriting config
  globals. Add a helper to RepoGroup to help with this.
* In refreshImageMetadata.php, add new options --convert-to-json and
  --split which reserialize metadata and optionally split out large
  items to blob storage.

Also, refreshImageMetadata.php was totally broken in the non-force mode
since metadata refresh on page view was disabled in b814245d9f. The
maintenance script was relying on newFileFromRow() magically upgrading
the row, which doesn't happen anymore. So, call maybeUpgradeRow()
directly.

Bug: T275268
Change-Id: I7bf7d9cef71641e287ca4346b568b381f4ada50e
2021-06-26 22:50:17 +00:00
jenkins-bot
2739509d38 Merge "Optionally split out parts of file metadata to BlobStore" 2021-06-26 20:32:04 +00:00
Arlo Breault
fdd8f864b8 Emit media structure as piloted in Parsoid
Gated behind the flag $wgParserEnableLegacyMediaDOM.  The scattershot
usage of it is a little unfortunate but isn't expected to live very long
so maybe that's acceptable.

Further details can be found at,
https://www.mediawiki.org/wiki/Parsing/Media_structure

Bug: T51097
Bug: T266148
Bug: T271129
Change-Id: I978187f9f6e9e0a105521ab3e26821e36a96b911
2021-06-24 23:32:40 +00:00
Amir Sarabadani
50888be5f4 Add support for multiple shellbox URLs through a mapping configuration
In order to avoid major disruptions, I introduced default value to
fallback to but in longer term we probably should deprecated it.

Bug: T285105
Change-Id: I81d9ece769c4942ef2ca390a40ff9d2c24c9ece4
2021-06-21 14:14:44 +02:00
Tim Starling
68ebdfc77f Optionally split out parts of file metadata to BlobStore
* Optionally store metadata in the database in JSON format instead of
  PHP serialization. The new JSON format has a top-level "envelope"
  array which gives us a place to store things that are not part of the
  handler metadata.
* Optionally split metadata items, putting items above a threshold into
  the text table. The FileRepo and MediaHandler must both opt in.
* For staged deployment, the read side of these changes is always
  active. Only the write side is configurable.

Bug: T275268
Change-Id: I876ea5c9d3a1881e278f689d2f8a3ae20240c703
2021-06-11 08:01:26 +10:00
Alexander Vorwerk
e34e93f24a Soft deprecate ContentHandler::getContentText()
ContentHandler::getContentText() was introduced as a migration
helper and is mostly pointless now. Thus it should be deprecated
and later removed. This patch softs deprecates that method.

This patch also deprecates the corresponding setting
$wgContentHandlerTextFallback.

Bug: T268041
Change-Id: I7d477935a16316996c4f52a3d6466029745817b4
2021-05-17 17:59:28 +00:00
James D. Forrester
f2f9345e39 Replace uses of DB_MASTER with DB_PRIMARY in documentation and local variables
This is just a start.

Bug: T254646
Change-Id: I9213aad4660e27afe7ff9e5d2e730cbf03911068
2021-05-14 12:40:34 -07:00
DannyS712
e11939f1d0 Inject load balancers into some authentication providers
Change-Id: Ie2407cdebf1bf565b0db2f0a6bd0f5dec043a1b9
2021-05-10 16:56:32 +00:00
daniel
c22695e5e7 Declare $wgCanonicalNamespaceNames in DefaultSettings.php
This ensures tests can run from phpstorm directly, without MediaWiki's
custom phpunit wrapper.

Background:
$wgCanonicalNamespaceNames needs to be declared in DefaultSettings so
it works properly when Setup.php is included via
wfRequireOnceInGlobalScope, as is the case in
MediaWikiIntegrationTestCase::initializeForStandardPhpunitEntrypointIfNeeded.

wfRequireOnceInGlobalScope will import any variables in the global scope
into the local scope to make them available in the included file. It
also exports all variables declared in the scope of the included file to
the global scope, but only after the file includsion returns.

If $wgCanonicalNamespaceNames is not defined in global scope before
Setup.php runs, then the $wgCanonicalNamespaceNames variable defined in
Setup.php will not become global until after Setup.php finishes.
However, Setup.php instantiates services that need
$wgCanonicalNamespaceNames to be present. This causes the test framework
to fail.

Change-Id: I8c5179433737170303f37cb072cb0352006ca173
2021-05-07 16:10:48 +02:00
Gergő Tisza
926cfa3b3d Use a constant for 'Maintenance script' username
The user 'Maintenance script' is often used to perform various
automated tasks. Providing it everywhere as a string literal is
error-prone, and errors can be somewhat disruptive (e.g. with
User::newSystemUser with steal=true it can erase the credentials
of a legitimate account). Provide a constant instead.
Also replace existing uses for consistency.

Change-Id: I685a5bfe56bbf1a47f35072f7f7c8be320ee27db
2021-05-03 23:34:26 +02:00
DannyS712
c6216377bb Remove deprecated https-related hooks
All hard deprecated in 1.35
* BeforeHttpsRedirect
* CanIPUseHTTPS
* UserRequiresHTTPS

Also soft deprecate the wfCanIPUseHTTPS
method, which always returns true. Will
be hard deprecated once callers are updated

Change-Id: Ie6d71809d09edf6be9b8280debeb152ef7fce398
2021-04-30 11:53:18 -07:00
jenkins-bot
9c269ae3b8 Merge "Add change tags for media additions/removals" 2021-04-28 15:13:34 +00:00
Thalia
c67f181dd4 Introduce infrastructure for partial blocks for actions
This adds a new type of block restriction for actions, which extends
AbstractRestriction. Like page and namespace restrictions, action
restrictions are stored in the ipblocks_restrictions table.

Blockable actions are defined in a BlockActionInfo service, with a
method for getting all the blockable actions, getAllBlockActions.

Action blocks are checked for in PermissionManager::checkUserBlock
using DatabaseBlock::appliesToRight. To make this work, this patch
also removes the 'edit' case from AbstractBlock::appliesToRight,
which always returned true. This was incorrect, as blocks do not
always apply to edit, so cases that called appliesToRight('edit')
were fixed before this commit. appliesToRight('edit') now returns
null (i.e. unsure), which is correct because it is not possible to
determine whether a block applies to editing a particular page
without knowing what that page is, and appliesToRight doesn't know
that page.

There are some flags on sitewide blocks that predate partial blocks,
which block particular actions: 'createaccount' and 'sendemail'.
These are still handled in AbstractBlock::appliesToRight, and are
still checked for separately in the peripheral components.

The feature flag $wgEnablePartialActionBlocks must set to true to
enable partial action blocks.

Bug: T279556
Bug: T6995
Change-Id: I17962bb7c4247a12c722e7bc6bcaf8c36efd8600
2021-04-27 21:53:13 +01:00
Matthias Mullie
dab7b16741 Add change tags for media additions/removals
This introduces 2 new tags to track changes in media usage
across articles. These tags are both hidden & disabled by
default.

Bug: T266067
Change-Id: Ia230eadf7dcf6f52facab17b92293f25de38bb1c
2021-04-26 12:22:21 +02:00
Timo Tijhof
bf62d08cd8 resourceloader: Add $wgIncludejQueryMigrate option
Bug: T280944
Change-Id: I61aa56368bf8868f369dfc294b5d7b4435013670
2021-04-24 03:01:23 +01:00
Timo Tijhof
bcfb945cf4 ImagePage: Add 2048px to $wgImageLimits for file description pages
1024px is becoming small a world of HiDPI screens. Wikimedia Commons
has worked around for this for over ten years with a JavaScript gadget
presenting links to 2000px. Let's standardise a similar size here so
as to obsolete that gadget.

Note that ThumbnailRenderJob (which is often a performance concern,
since it pre-renders thumbnails for all new uploads), is based on
$wgThumbLimits, not $wgImageLimits.

Bug: T106263
Change-Id: If3be7edc260c69aaedbe87e3ce8f578af57dbda6
2021-04-20 23:50:42 +01:00
jenkins-bot
11c7b11398 Merge "resourceloader: Remove support for $wgLegacyJavaScriptGlobals" 2021-04-19 23:17:27 +00:00
Amir Sarabadani
99d4ad5995 resourceloader: Remove support for $wgLegacyJavaScriptGlobals
Bug: T72470
Change-Id: I321a3bf5a85e2b4069ef003db65ac93b69692c83
2021-04-19 22:54:43 +00:00
Taavi Väänänen
23efcf9dbf
Add change tag for media uploaded using importImages.php
Change-Id: I74a7d6f9e5e7bada4803f7e807c7c74d237e9d47
2021-04-17 22:45:52 +03:00
jenkins-bot
0af0b25565 Merge "SessionManager: Document expectations for storage backend" 2021-04-14 15:20:37 +00:00
Amir Sarabadani
72cf766c75 Document $wgLegacyJavaScriptGlobals as already deprecated in 1.36
Prepare for removal in a couple of weeks. It is already implicitly
called deprecated in HISTORY. Making it explicit.

Bug: T72470
Change-Id: Ieb1d130038823e90d6196d236f02733fd47e03d4
2021-04-10 21:53:45 +00:00
jenkins-bot
e5d1c50c6f Merge "Some reorganisation of DefaultSettings.php" 2021-04-09 07:36:22 +00:00
Tim Starling
aa94551c2b Make SpecialFileDuplicateSearch not be a QueryPage
Since 2011, FileDuplicateSearch has been especially awkward as a
QueryPage subclass. The only thing of value in the parent was
construction of <ol></ol> tags, but that's not enough to justify it.
getQueryInfo() was unused  -- my motivation is to not have to maintain
it. A LoadBalancer was injected but was unused.

Change-Id: I2f0c18913260ee74ef266352bb93cfbdc1143d85
2021-04-08 14:39:01 +10:00
Tim Starling
aca13bde36 Some reorganisation of DefaultSettings.php
The main goal was to reduce the size of the "miscellaneous" section,
which I think was successfully achieved. But I also found some
miscategorized settings, and I broadened some small sections.

* Broadened "text storage" to "Content handlers and storage", so that we
  have a place for content handler settings. I put a couple of diff
  settings here on the basis that they configure
  ContentHandler::getSlotDiffRenderer() (or at least should).
* Created a new "security" section as somewhere to put $wgSecretKey and
  related misc settings. This is vague and overlapping but better than
  just dumping everything in "miscellaneous".
* I split out interwiki settings to a separate section, and put sites
  there too, since it seemed quite distinct and there was enough of it.
  The remaining "page title" section already had redirects, so I made
  that explicit and brought in a few more redirect settings.
* The tiny "statistics" section was broadened to include "content
  analysis", which allows us to bring in the new experienced user
  settings, by analogy with $wgActiveUserDays which was already there.

Change-Id: Ic1c36664e7535c36db58e2818339e911aad05631
2021-04-07 16:32:23 +10:00
Reedy
432a7b62ba DefaultSettings: Fix documentation of user-global in $wgRateLimits
Change-Id: I0aa567c69bcf2cf1ca11dfbf4af43734ef2f9e61
Follows-Up: Id680b96be2ea81d29447c4c1abafc8f98a339626
2021-04-03 11:49:38 +01:00
jenkins-bot
41456132c2 Merge "Revert "Add change tags for media additions/removals"" 2021-03-26 15:42:17 +00:00
Urbanecm
5519a25cf2 Revert "Add change tags for media additions/removals"
This reverts commit 5a0bfa9d98.

Reason for revert: caused a train blocker (T278429) plus Daniel says it's "super expensive"

Bug: T278429
Bug: T266067
Change-Id: I6724b4bc02d29c12c3fe18cc1e8fa17a443257d5
2021-03-26 15:16:08 +00:00
Reedy
9f316e2921 Update comment after renaming PoolCounter Client
Extension was namespaced in b808f41707a1124d8.

Change-Id: I1f37acb3f6fe6c45353bcf14a998d04fa9630d71
2021-03-24 03:13:23 +00:00
jenkins-bot
e3cdbbdbaf Merge "Add change tags for media additions/removals" 2021-03-22 17:51:04 +00:00
mainframe98
20fc80577b Rename $wgSlaveLagWarning and $wgSlaveLagCritical to match DB_REPLICA
These are now named $wgDatabaseReplicaLagWarning and
$wgDatabaseReplicaLagCritical, respectively.

Bug: T277987
Change-Id: I62d8c2028fdfee00904f1058f8387499f2b2e977
2021-03-21 17:58:15 +00:00
Reedy
cce3fb49d0 Use more neutral or alternative language
Bug: T277987
Change-Id: Iafc4b3e3137936046487119b7e17635f4e560277
2021-03-20 19:47:18 +00:00
Reedy
7ff132bd74 Remove deprecated PasswordCannotMatchBlacklist and PasswordNotInLargeBlacklist
Bug: T254646
Change-Id: I77d303d1bd4791f1c75e1892687ffd668d758214
2021-03-19 17:31:51 +00:00
jenkins-bot
e0006fd267 Merge "rdbms: Improve ChronologyProtector documentation" 2021-03-18 21:32:08 +00:00
C. Scott Ananian
77c48b6857 Remove Parser::$mConf
This was deprecated in 1.34 and then made private; no one uses it any more.

Code search:
https://codesearch.wmcloud.org/search/?q=-%3EmConf&i=nope&files=&excludeFiles=&repos=

Bug: T275160
Change-Id: I4f054328dcc20091030c130ddbcb5fac1eeeac82
2021-03-16 19:43:22 +00:00
Cindy Cicalese
0b17d02d92 Make RememberMe authentication behavior configurable.
RememberMeAuthentication request shows a "remember me" checkbox that,
when checked, will extend the amount of time before the authenticated
session expires. It was previously not possible to extend the session
when the login form is skipped, which happens when there are no
non-skippable fields on the form. This patch introduces a configuration
variable, $wgRememberMe. Valid values are:

- CHOOSE_REMEMBER: the user may be able to choose whether to be
remembered or not (depends upon whether login form is skipped)

- FORCE_CHOOSE_REMEMBER: the user will be able to choose whether to be
remembered or not (forces login form not to be skipped)

- ALWAYS_REMEMBER: the authenticated session will always be extended

- NEVER_REMEMBER: the authenticated session will never be extended

Default behavior is identical to what it was before adding this
functionality.

Bug: T265263
Change-Id: I779aae3c1b96b380b50092245f616219088b038d
2021-03-14 12:31:41 -04:00
Ammarpad
b754d1eeae Remove $wgPagePropsHaveSortkey
This is no longer useful. The schema update it supports
has been removed: patch-pp_sortkey.sql/(I76b4235)

Bug: T273978
Change-Id: Ida469a5401f98a028b7a69242105dc1595af3613
2021-03-13 12:08:49 -08:00
Reedy
d0e5057f37 Drop $wgEnableRestAPI, deprecated in and ignored since 1.35
Change-Id: I2cfffb02d5ece67b3ddbbf4cb50e10e60d7ac7a1
2021-03-12 10:06:34 -08:00
Timo Tijhof
d0f0deebc6 rdbms: Improve ChronologyProtector documentation
Follows-up bd7cf4dce9.

Bug: T254634
Change-Id: I30e51df7eca64a6d86e5a90e15d5aacf7471ed31
2021-03-10 17:38:58 +00:00