Commit graph

200 commits

Author SHA1 Message Date
xtex
a668a1bbea Add support for user-groups-based conditional options filter
Bug: T363059
Change-Id: I728cacf6acfc02ecb0ef9b3695e7770c2d3f8d83
2024-06-29 07:07:06 +00:00
Reedy
3e44763daf Defines.php: Improve $wgVersion comment
Change-Id: I6898f646dc59503f8839f53a070fcf07351bc638
2024-05-13 15:26:56 +00:00
James D. Forrester
b62087dea2 Prepare active branch following REL1_42 cut, labelling as 1.43-alpha
Bug: T359839
Change-Id: Idf875e340520f9d05869f9d5d2df34f782d977c5
2024-04-08 21:35:12 -04:00
Steph Toyofuku
1e26f420dc Add new conditional default conditions for user options: anon and named
Adds two new conditional user option default conditions CUDCOND_ANON and
CUDCOND_NAMED, for the purpose of allowing the specification of a
separate default user option for logged-out users.  We're taking two
different approaches to the targeting of logged-out users (anon vs
named) because of the temporary users project - anon will not include
temporary users while named will allow us to target only fully created
user accounts.  This will be ultimately be used for the rollout of the
reading accessibility settings menu

Bug: T360098
Change-Id: I316d231330159770f05234dd2f5fdb7d07531002
2024-04-02 14:46:53 -07:00
Martin Urbanec
6c8b696020 Add support for conditional user defaults
Why:
Sometimes, it is necessary to have different behavior
for newly registered and existing users. For example,
this happens in the Echo or GrowthExperiments extensions.
As of now, this behavior is implemented by inserting
user_properties rows in onLocalUserCreated.

Over time, this results in a singificant amount of rows
inserted, which contributes to the user_properties table bloat,
which is already overly large (cf. T54777). This patch makes it
possible to remove such rows by supporting conditional defaults
for user properties.

What:
Add support for conditional defaults of user properties. This can be
configured via `ConditionalUserOptions` config option.

Bug: T321527
Change-Id: I1549c3137e66801c85e03e46427e27da333d68e2
2024-01-09 02:33:17 +00:00
James D. Forrester
f404d44e85 Prepare active branch following REL1_41 cut, labelling as 1.42-alpha
Bug: T346925
Change-Id: If60d14681be9a0655d6948289f95389a35d5824f
2023-10-09 22:11:03 -04:00
Derick Alangi
8abcc65747 parser: Remove b/c alias Parser::OT_MSG flag
In https://static-codereview.wikimedia.org/MediaWiki/29945.html,
this flag/constant was aliased for backward-compatibility and it
has been a very long time now (since 2008), there is usage.

The constant is no longer used anywhere, just a comment in mw-config
which I'll remove in another patch.
See: https://codesearch.wmcloud.org/search/?q=%28Parser%7Cself%29%3A%3AOT_MSG&files=&excludeFiles=&repos=

Change-Id: I8f065af61bd497a5174c553d754c5484c8639dff
2023-09-05 12:19:08 +00:00
James D. Forrester
941cb3a13a Prepare active branch following REL1_40 cut, labelling as 1.41-alpha
Bug: T329079
Change-Id: Ia43b5da4025747cfe5c00de7121d03dd2333dfd7
2023-03-13 22:49:46 -04:00
James D. Forrester
4281c88132 Prepare active branch following REL1_39 cut, labelling as 1.40-alpha
Bug: T313920
Change-Id: If0da235a55c0379e4217bbd76adf1cbd0024e464
2022-09-05 20:30:54 -04:00
daniel
bf092744c9 PHPUnit: introduce setMainCache
The main object cache is disabled during testing. Some integration tests
need it though. This provides a clean way to enable it, to replace the hacks
that were used so far.

Note that we may want to enable the main cache during testing soon. When
that happens, this method is still useful to disable the cache in certain
tests, and to set a specific cache instance.

Change-Id: I04ae1bf1b6b2c8f6310acd2edf89459d01a9c870
2022-07-07 16:25:59 +10:00
Aryeh Gregor
b85391120b Use UrlUtils in Parser
Change-Id: I65f851ea29efe482ee225565a200d623fa85bc20
2022-04-28 17:14:51 +03:00
Aryeh Gregor
472a914c63 Refactor URL-parsing global functions to class
The new class, UrlUtils, is usable standalone or as a service. Using it
as a service will just automatically load a few settings from site
configuration.

In addition to just making our code cleaner, this will enable making
some of Setup.php's dynamic configuration more sane.

Test coverage is all lines except invalid URLs -- I couldn't find any.

Bug: T305093
Change-Id: I706ef8a50aafb518e13222719575d274c3583b90
2022-04-12 15:14:35 +03:00
James D. Forrester
000fddc9ac Prepare active branch following REL1_38 cut, labelling as 1.39-alpha
Bug: T302909
Change-Id: Ic20da125a9252e78d704af0ef1bbca32e071523e
2022-03-14 21:50:17 -04:00
daniel
a5277ce87f Avoid references to DefaultSettings.
This replaces references to DefaultSettings with
references to config-schema.yaml where appropriate.

NOTE: this does not yet change Setup.php. DefaultSettings.php
remains intact and is still being used.

NOTE: this does not remove usages in the installer, see I5d8843a1062fbf
for that.

Bug: T300129
Change-Id: Ie6152cf510c3be61bc22167ca6d90dfc28910a45
2022-02-22 19:43:50 +01:00
Aaron Schulz
61c6b312e0 objectcache: make CACHE_MEMCACHED alias "memcached-php"
This avoid duplicating the "memcached-php" instance/connections

Change-Id: I2a9a8182c064c326e9320d82774c5470424a5cfe
2021-11-10 18:55:47 +00:00
James D. Forrester
a0b8b4b288 Prepare for REL1_37 cut, labelling master as 1.38-alpha
Bug: T289586
Change-Id: I5d64cad0b63c1ef98cb945bb48594a22e05f50cc
2021-09-13 19:19:42 -07:00
Thiemo Kreuz
380e8ca784 MW_VERSION also exists in 1.33.3 and 1.34.1
While this was introduced in 1.35, it got backported to 1.33.3 and
1.34.1, as far as I can tell.

Bug: T212738
Change-Id: I3fb684a0a4a7d6bbb6b8aebef17082253b781a04
2021-08-19 06:54:29 +00: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
4cf2534b91 Defines.php: Drop obsolete Anti-lock flags
There's no need to continue keeping these.
Direct upgrade from 1.25 is no longer supported.

Bug: T253436
Change-Id: I4686f8caaea94c7136ab859e10a6bd834b8c89d3
2021-06-03 07:14:03 +01:00
James D. Forrester
c791a1a4a9 Prepare for REL1_36 cut, labelling master as 1.37-alpha
Bug: T279456
Change-Id: Iffb6d982e402d998343ffa00f23bb29fba1723b9
2021-04-06 23:03:22 +00:00
James D. Forrester
921343b3f9 PHPVersionCheck: Complain about known-bad versions above minimum
For now, this complains about 7.4.0 – 7.4.8, and 7.3.0 - 7.3.18.

We will back-port this to the REL1_35 live release branch with
modifications as that requires 7.3.19+ already.

Bug: T246594
Bug: T270228
Change-Id: If5c7e3c1ba9dd9f6561c1de18130ded3aadc7149
2021-02-25 15:17:21 +00:00
Tim Starling
9af96ef4c7 Improve custom folding and grouping
PHPStorm can use custom folding regions defined in either the
VisualStudio style or the NetBeans style. The VisualStudio style is more
pleasing to the eye and also works as a vim foldmarker. So get rid of
the previous vim foldmarkers, and use region/endregion.

region/endregion need to be in a single-line comment which is not a doc
comment, and the rest of the comment is used as a region heading (by
both PHPStorm and vim). So to retain Doxygen @name tags, it is
necessary to repeat the section heading, once in a @name and once in a
region. Establish a standard style for this, with a divider and three
spaces before the heading, to better set off the heading name in plain
text.

Besides being the previous vim foldmarker, @{ is also a Doxygen
grouping command. However, almost all prior usages of @{ ... @} in this
sense were broken for one reason or another. It's necessary for the @{
to be in a doc comment, and DISTRIBUTE_GROUP_DOC doesn't work if any of
the individual members in the group are separately documented.

@name alone is sufficient to create a Doxygen section when the sections
are adjacent, but if there is ungrouped content after the section, it
is necessary to use @{ ... @} to avoid having the Doxygen group run on.
So I retained, fixed or added @{ ... @} in certain cases.

I wasn't able to test the changes to the trait documentation in Doxygen
since trait syntax is not recognised and the output is badly broken.

Change-Id: I7d819fdb376c861f40bfc01aed74cd3706141b20
2020-12-23 12:41:47 +11:00
DannyS712
300283e3e9 Remove an extra space from Defines.php
Change-Id: I9432e07061b8aa48641366976f4c470831e04fd2
2020-10-18 09:04:53 +00:00
daniel
a67cad6d0f Create fallback for undefined content models.
This causes RevisionStore to use FallbackContent instances to represent
content for which no content handler is defined.

This may happen when loading revisions using a model that was defined
by an extension that has since been uninstalled.

Bug: T220594
Bug: T220793
Bug: T228921
Change-Id: I5cc9e61223ab22406091479617b077512aa6ae2d
2020-07-22 19:59:09 +02:00
James D. Forrester
2d7fe2d6c8 Prepare for REL1_35 cut, labelling master as 1.36-alpha
Change-Id: I91fc77a436468fa9a549383c1dac701cc5f5b6fe
2020-07-14 06:52:04 +01:00
Petr Pchelko
cd6b72ecd7 Move autopromote groups logic into UserGroupManager
Bug: T252621
Change-Id: Ic51119cd01771ab1b68294fa5dfacb8034e33b6b
2020-06-11 22:13:48 +00:00
Ed Sanders
387f3c2a20 Fix typo: 'the the' -> 'the'
Change-Id: Ia57fb787b43c8e49da4f33a65c265cbc37ee1f77
2020-05-03 20:45:36 +01:00
Timo Tijhof
a5d5ea82ca Provide MW_VERSION and deprecate fake global $wgVersion
$wgVersion is not a configuration variable, it should never be
changed at run-time.

While we've gone in the route of class constants for most constants,
this one will not benefit from class-autoloading since it needs to
be present from the very beginning.

MW_VERSION is named similarly as PHP_VERSION, and $wgVersion is
now soft-deprecated.

Bug: T212738
Change-Id: I04628de4152dd5c72646813e08ff35e422e265a4
2020-02-25 01:55:21 +00:00
Umherirrender
2664eeb632 Clean up spacing of doc comments
Align the doc stars and normalize start and end tokens

Change-Id: Ib0d92e128e7b882bb5b838bd00c74fc16ef14303
2019-08-05 22:29:50 +00:00
James D. Forrester
f70d270877 Drop NS_IMAGE and NS_IMAGE_TALK, deprecated in 1.14
Change-Id: Id980c3d9bbadae219181b07f22aa58cbc2efbdc6
2019-07-15 20:09:58 +00:00
daniel
fdc3e9f952 Add support for xml dump schema 0.11
Bug: T174031
Change-Id: I2717019ea7efe36694bd2b2fba4dc2952a987cfc
2019-06-27 21:56:01 +00:00
James D. Forrester
0653e575fc Defines: Drop DB_SLAVE, deprecated since 1.28
Change-Id: I9b48524bfa071c21e03c50e9e8231e4661917c78
2019-06-14 06:44:38 -04:00
daniel
45f3912bf1 Make the XML dump schema version configurable.
Bug: T174031
Change-Id: I979b6c8f0a72bc1f5ecce1d499d3fdfa0f671588
2019-03-21 12:43:32 +01:00
Thiemo Kreuz
22f5babf4d Update @deprecated comment for the DB_SLAVE constant
I keep searching for the proper replacement for this deprecated
constant. It's much easier to find when the @deprecated comment
just mentions it.

Change-Id: I199b876ecfb6e146848b395bc7bfad80742f000d
2019-02-12 13:05:03 +01:00
Fomafix
1472f02b36 Phabricator: Use Tddddd instead of Bug ddddd in comments
Change-Id: Ic9fe03cab270bd6be738af346164ad5d31a0d780
2018-10-04 09:15:02 +02:00
daniel
33258e04d1 Introduce new schema flags and use them in RevisionStore.
NOTE: this changes the numeric values of the MIGRATION_XXX constants!
Order is preserved.

Bug: T197619
Change-Id: I16db7dd5799ab98c1cb12e7cd1e0b2da83b366fc
2018-07-02 17:20:14 +02:00
Kunal Mehta
88ea69f2f7 Remove deprecated utfnormal back-compat
Change-Id: Id8f497d0bbaab8282057c9d271a7c9b1e77d1a3f
2018-05-27 20:35:27 -07:00
Chad Horohoe
5c93fabafd Drop XCache support
It was never super popular anyway, APC was always the best option.
The project has no plans to move to PHP7, so it's quickly reaching
its end of life. Oh, and Fedora dropped it from their repos 2 years
ago.

Change-Id: Ia3257e86a6323d8943f04a5c05c72c0bd4c4b0a9
2018-02-07 13:45:40 -08:00
Kunal Mehta
92c3b2404e Document DB_SLAVE as deprecated
Change-Id: I50c127b7857b6dbccfd09014d72a130071870fab
2017-09-06 18:09:42 -07:00
Brad Jorsch
1acb816a47 Add constants for schema migration feature flags
A general behavior is to progress through four stages:
* Access only the old schema (until the schema change is deployed to the
  databases)
* Read and write both schemas (for easy rollback while testing)
* Write only the new, read both (while a maintenance script runs to
  migrate existing old schema to the new)
* Access only the new schema (then we can drop the old)

This adds constants for use with feature flags controlling these stages.

Bug: T166732
Bug: T167246
Change-Id: I0fb637ca8c10ec91d6eda706d9d8a5ce9be41a06
2017-06-07 09:38:46 -04:00
Aaron Schulz
488a647831 Move IDatabase/IMaintainableDatabase to Rdbms namespace
Change-Id: If7e8a8ff574661fd827de8bcec11d2c39a687300
2017-03-28 15:32:38 -07:00
Kunal Mehta
a57b64436c Use wikimedia/timestamp
Bug: T100924
Depends-On: I0a067367cda6885fa45631ed7c18799d653dc9bf
Change-Id: I69ba64e364df8af089c1c918cdf32f99454e693a
2017-02-28 21:15:38 -08:00
Timo Tijhof
34060273e7 Move libs/time/defines.php inclusion from GlobalFunctions to Defines.php
* Verified none of these constants depend on each other.
* Move them to the top of Defines.php for consistency.

Change-Id: I19c77e706d69bff513e4abafd0300207de0dbb1d
2017-01-13 01:17:32 +00:00
Aaron Schulz
0d87d67d61 Move MimeMagic code to libs/mime/MimeAnalyzer.php
* The later resides in /libs with related files.
* Explose MimeAnalyzer as a service.
* Keep MimeMagic::singleton() as a b/c alias.
* MimeMagic::applyDefaultConfig() will bootstrap the service
  with all of the old config, extension hook handler, and
  detector command shell-out behavior.

Change-Id: Ie2695a52e7a3bcfda9f7fa83659a9ff31b372bc3
2016-10-15 00:05:16 +00:00
Kunal Mehta
bb0b1f60be Add @deprecated annotations to NS_IMAGE and NS_IMAGE_TALK
Hopefully this will discourage people from using them in new code.

Change-Id: I165a19406dfc0bcc471252e416480fa3af92d969
2016-09-27 20:40:17 -07:00
Aaron Schulz
ff38b54d61 Move LIST_ constaints to IDatabase class constants
Leave aliases in Defines.php for backwards compatibility.

Change-Id: I88b45e0943cbfe97d863c2e0a4911fc0f81e5bb5
2016-09-19 07:59:21 +00:00
Aaron Schulz
2547821e7f Move database constants to their own file
Change-Id: I47e067687bbce7b89e02a0e732ee27368beddb61
2016-09-16 00:31:50 +00:00
Aaron Schulz
1a535a1405 Remove ancient DB_READ/DB_WRITE constants
Change-Id: I23f4c52312317e41710bc12eefe6e821f9b9e9f3
2016-09-07 09:50:25 -07:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.

The old constant is an alias now.

Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
2016-09-05 22:55:53 -07:00
Aaron Schulz
16266edff3 Change "slave" => "replica DB" in /includes
Change-Id: Icb716219c9335ff8fa447b1733d04b71d9712bf9
2016-09-05 21:01:01 +00:00