Commit graph

1181 commits

Author SHA1 Message Date
Reedy
b16a862d43 Upgrade doctrine/dbal from 2.10.4 to 3.0.0 for PHP 8.0 support
Some irritating breaking changes, including dropping PHP 7.2 support
and renaming the classes we care about. For now, hack in via || and
some back-compatibility class aliases.

Bug: T270732
Change-Id: I685f099584d2f0e5fa17f1f4275eab5289c7bfee
2020-12-23 02:24:31 +00:00
David Kamholz
9cb5187944 Implement Balinese language converter
This patch implements the BanConverter class for Balinese. Its purpose is to transliterate Balinese in Balinese script to Latin script. Latin to Balinese is not currently supported, because (1) the Latin transliteration is not fully one-to-one, (2) I'm not aware of any users who currently need Latin to Balinese.

The converter supports three distinct Latin transliteration variants: ban-dharma, ban-palmleaf, and ban-puri-kauhan-ubud. All three variants have been requested by different Balinese community members working with Balinese palm-leaf manuscripts. ban-puri-kauhan-ubud is the default, as it is the most familiar to lontar scholars, but Balinese Wikisource users will be able to select their preferred variant via a user script.

Conversion is accomplished via ICU Rule-Based Transliterators, bindings for which are available through the Intl extension.

This patchset adds the abstract class LanguageConverterIcu and has BanConverter inherit from it (makes future ICU-based LanguageConverters easier).

Bug: T263082
Change-Id: Ic3a46a215fbf020a022726e6b130b1d25496e284
2020-12-21 12:45:41 -08:00
daniel
00a3439dce Introduce RevisionOutputCache
Bug: T267981
Change-Id: Ib1dc641ed10d786918362b25bd655780d5844ba1
2020-12-14 16:50:28 +00:00
jenkins-bot
8cafbac2b8 Merge "Introduce DoctrineAbstractSchemaTrait to share schema spec logic" 2020-11-19 04:46:20 +00:00
Amir Sarabadani
1f1ff1377a Introduce DoctrineAbstractSchemaTrait to share schema spec logic
Bug: T230420
Change-Id: I4d78b57c097e4213e2c1462a83f02bbfa7ac0a0e
2020-11-19 01:16:10 +01:00
daniel
a2ae4192c0 ParserOutputAccess: cache ouput for old revisions
DEPLOY: Set $wgOldRevisionParserCacheExpireTime = 0 in production first!

Bug: T267832
Depends-On: I3c73f5d9f6a54e2736600e8f9506659a3fb0e7f6
Change-Id: I0fe275b4991f1bf89c7bb587132bc4fb0ea862e2
2020-11-17 20:52:35 +00:00
daniel
ed41864370 Extract PoolWorlArticleViewCurrent
Extracts a specialized subclass for rendering the current revision
from PoolWorlArticleView, which then no longer knowes about caching.

In the next step, we will add a subclass that implements caching for old
revisions.

Bug: T267832
Change-Id: I56fb365962951e6c723a01cf9243dbc0094b5581
2020-11-17 20:17:02 +01:00
Ammar Abdulhamid
8d5d00086a Add custom ENUM datatype for doctrine DBAL
Bug: T230428
Change-Id: I5bcdfa4a63b3e278ff7db318fd957c2adf43b2fb
2020-11-17 06:08:24 +01:00
jenkins-bot
d009d75c73 Merge "Start generateSchemaChangeSql.php" 2020-11-16 08:40:36 +00:00
Petr Pchelko
017cfcf016 Forward-compat for merging CacheTime and ParserOutput mOptions
CacheTime::mUsedOptions and ParserOutput::mAccessedOptions
do exactly the same thing and has to be merged into a single property.
This patch adds forward-compatibility and needs to be deployed
at least one train before the patch which actually merges the properties.

Change-Id: Ic9d71a443994e2545ebf2a826b9155c82961cb88
2020-11-10 07:09:41 -07:00
Petr Pchelko
f11ed7e46f Add forgotten import hook interface
When making primitive tests for HookRunner in
I8d0a34e185aad79a391acdd47e506c8911c75257 I've
notived that coverage was not 100% and found that
this hook interface was forgotten.

Change-Id: Ic877fd1f2bbac5a1af708f283e9e0b7a49f89d88
2020-11-02 08:17:34 -07:00
Amir Sarabadani
1125167b8d Start generateSchemaChangeSql.php
Creating schema changes from abstract schema and even abstracting a
schema change.

Bug: T230420
Change-Id: If626e866642af820dd70c5f9b0fe7c6a951e0a25
2020-11-01 21:14:53 +01:00
Petr Pchelko
1f2f71ff60 Remove ProcessCacheLRU, deprecated and unused.
Change-Id: I88c30c2480c51ad18d9a14d9f75700087ed09b99
2020-10-20 12:49:05 -07:00
Petr Pchelko
e11ea52576 Remove SVGMetadataExtractor deprecated and unused.
Change-Id: Ia30e59d1ff93129d48b4e6f0df76879407b5e3e2
2020-10-19 20:53:08 -07:00
Ammar Abdulhamid
bb2d35e8ad Vary timestamp default value per platform in abstract schema
To accommodate PG-unique timestamp format, if there's a
timestamp field in a column, and there's a default value,
the given timestamp will be converted to PG-compatible format
in the final schema output.

SQLite and MySQL use the same format.

Bug: T191231
Change-Id: If344395615087c360597a5b3d66ea03e930b7d9b
2020-10-17 20:21:51 +01:00
Petr Pchelko
13574e8404 Deprecate ParserCache::getKey and replace it with getMetadata
Bug: T263689
Change-Id: I4a71e5a7eb1c25cd53b857c115883cd00160736b
2020-10-13 08:31:22 -07:00
DannyS712
1f1793dc06 Convert UserNamePrefixSearch to a service
Replace existing class with static ::search method
with a service under MediaWiki\User\ and with
dependencies injected

Similar to the creation of the SpecialPageFactory
service, rename the old file to UserNamePrefixSearch_deprecated
so that UserNamePrefixSearch.php can be used for
the service.

Follow-up patches will:
* Inject and use the new service
* Update the release notes
* Replace the use of the UserFactory with UserNameUtils

Change-Id: Ib78b9bdc96c935d75bd03a8af789b8b359c58b07
2020-10-08 00:14:41 +00:00
jenkins-bot
b1308abc3d Merge "maintenance: Move cleanupTable from .inc to .php" 2020-09-29 06:07:39 +00:00
daniel
dc436c3cff Introduce and apply NonSerializableTrait
The NonSerializableTrait prevents object serialization via php's native
serialization mechanism. Most objects are not safe to serialize, and
NonSerializableTrait provides a covenient and uniform way to protect
against serialization attempts.

This patch applies the NonSerializableTrait to some key classes in
MediaWiki.

Bug: T187731
Bug: T259181
Change-Id: I0c3b558d97e3415413bbaa3d98f6ebd5312c4a67
2020-09-28 21:55:49 +02:00
jenkins-bot
f6f40e0f95 Merge "maintenance: Move commandLine from .inc to .php" 2020-09-28 17:29:12 +00:00
jenkins-bot
17291773c1 Merge "Create ParserCacheFactory." 2020-09-28 16:13:37 +00:00
James D. Forrester
7282ea26a4 maintenance: Move commandLine from .inc to .php
… and fix the name to match the class.

Bug: T184782
Change-Id: Id3d0d0a6b3f2da6316d18eb57804c5a2b697108b
2020-09-28 15:03:05 +00:00
Petr Pchelko
fec48eb5a4 Create ParserCacheFactory.
* Makes ParserCache take the root of the key
  as a constructor argument
* Introduces a ParserCacheFactory

Next steps:
- convert FlaggedRevs to using this.
- cleanup

This assumes that we wouldn't want to differentiate
the parser cache settings per use-case, as it is now
for default vs flaggedrevs caches. There are only two settings:
$wgParserCacheType - name of the BagOStuff to use
$wgParserCacheExpireTime - the expiration time.
I think if we wanted to have different settings for different
caches, we could add that as a next step.

Bug: T263583
Change-Id: I188772da541a95c95a5ecece7c7dd748395506c2
2020-09-25 18:17:58 -07:00
James D. Forrester
74ee16732e maintenance: Move cleanupTable from .inc to .php
… and fix the name.

Bug: T184782
Change-Id: I670af00baed690ef57413e721b8f5f615ea46502
2020-09-25 17:36:39 +01:00
James D. Forrester
be448ac1b2 maintenance: Move sqlite from .inc to .php
Bug: T184782
Change-Id: I18fabbcc8588518f5cc10c8e3f0fba2379263c6c
2020-09-25 17:36:38 +01:00
James D. Forrester
4272da2c62 maintenance: Move sqlite.php to SqliteMaintenance.php to match class name
Change-Id: I4d6be08082fd1841d3056a0554376e8e9665b429
2020-09-25 17:36:36 +01:00
James D. Forrester
562f0fa8fb maintenance: Move userDupes from .inc to .php
Bug: T184782
Change-Id: I99056b21664a460ec2b16899e7cfa617511b7d0b
2020-09-23 11:59:41 +01:00
James D. Forrester
edc2b8d323 maintenance: Move CodeCleanerGlobalsPass from .inc to .php
Bug: T184782
Change-Id: Ifefeb88e3e84eff909ad56aef630b94df8250429
2020-09-23 11:59:41 +01:00
jenkins-bot
2cbf3de509 Merge "Remove ParserBeforeStrip/ParserAfterStrip hooks, deprecated in 1.35" 2020-09-23 09:26:01 +00:00
jenkins-bot
a01f759fbb Merge "Add FindMissingActors script." 2020-09-23 06:56:34 +00:00
daniel
dbe7fdb94c Add FindMissingActors script.
This allows bad actor IDs to be overwritten with some default. This
solves the problem of rows in tables like ipblocks, logging, or
revision not being found due to a failing join against the actor table.

Bug: T261325
Change-Id: Ibc554d0b6f52e7b30cdde5138ac165774831ec36
2020-09-22 21:10:16 +02:00
C. Scott Ananian
aae8b558c3 Remove ParserBeforeStrip/ParserAfterStrip hooks, deprecated in 1.35
Everything code search:
https://codesearch.wmflabs.org/search/?q=ParserBeforeStrip%7CParserAfterStrip&i=nope&files=&repos=

Bug: T250449
Bug: T250450
Change-Id: I91e6753a9159bb7f8d699c79fd20483c42be33aa
2020-09-20 14:12:18 +01:00
Amir Sarabadani
c1ffa95444 Introduce TinyInt db datatype for doctrine DBAL
This handles cases like booleans where we go with tinyint.

Bug: T230428
Change-Id: I6cac7d57ac777e1959283f6837b593e4f1726026
2020-09-17 10:21:47 +02:00
Amir Sarabadani
1ac06ab2f2 Introduce TimestampType for handling custom db type in doctrine
This is needed as Doctrine DBAL can't understand the data type we have
here.

Bug: T42626
Change-Id: Id94e74e1b6bdd2bdf36fc21412ed69a271e3a8c8
2020-09-17 10:12:13 +02:00
Ostrzyciel
a47778d5c0 Add mw-reverted change tag
The tag is added to reverted edits as described in T254074.

Functionality:
* Adding the mw-reverted tag to reverted edits (duh)
* Limiting the maximum depth of the update through a config variable
(mitigation #2 from T259014).
* Only applying the reverted tag after the edit has been somehow
approved. Only the patrol subsystem currently implements this, but
there's a hook that extensions can use (mitigation #4 from T259014, more
explanation in T259103).
* When performing the delayed update, it is checked whether the reverted
edit was reverted itself. If so, the update is ignored. This is
probably the only way to make the feature work due to the lack of an
explicit "disapproval" mechanism other than reverting.
* The update is also ignored if the revert is marked as deleted.

Technical design:
* The update code is in RevertedTagUpdate.php, which is a deferrable
update, but is not used as such. It's separated to allow for better DI,
testing and better code reusability in the future.
* The update is queued / ran using the Job subsystem. The relevant job
is in RevertedTagUpdateJob.php
* PageUpdater determines whether the edit is approved or not and passes
that to the DerivedPageDataUpdater.
* The BeforeRevertedTagUpdate hook lets extensions decide whether the
update should be ran right away or await approval.
* DerivedPageDataUpdater checks whether the edit is a revert and if so
either enqueues the job (if it's auto-approved) or caches the EditResult
for later use (if it needs approval).
* RevertedTagUpdateManager allows for easy re-enqueueing of the update
for extensions. Thus, it has a very minimal interface.

Other notes:
* The unit testing setup for RevertedTagUpdate is a bit complicated,
but it was the only way I could make this class testable while using
the static ChangeTags class.

Bug: T254074
Depends-On: I86d0e660f0acd51a7351396c5c82a400d3963b94
Change-Id: I70d5b29fec6b6058613f7ac2fb49f9fad9dc8da4
2020-08-31 13:40:50 +00:00
Reedy
0c91dca0f8 Remove maintenance/createCommonPasswordCdb.php
Change-Id: I7aad72f4b72e68f66547f0f558db013ea6bef936
Follows-Up: I77432ef0257c0dc8aa7c26e075616592e639bfec
2020-08-25 00:11:23 +01:00
Derick A
3e92cf9cde maintenance: Print version of MediaWiki on the command prompt
In the past, $wgVersion was the global container used to keep
track of the version of MediaWiki. It was recently moved to a
constant (MW_VERSION).

Sometimes, it's difficult to know the current version of a MW
install unless checked via Special:Version (on the web interface).
This script is to make a quick command line based version checker
of MediaWiki so when someone is working on a patch and wants to
quickly know which version of MW that master is on (as this is
changing from time to time and no quick way to know if by developers).

It's a very simple script and to run it on your command line, do:

`php maintenance/version.php`

and you'll get a response with the MW version number and other info.
Also, it attempts to check that if the version is an LTS and appends
it to the version number and also build date which is the latest commit
tracked by git.

Change-Id: I547f3e7328cf3f18b9d414619b757efc81e63081
2020-08-23 23:20:44 +00:00
Alex Dean
8c8654cce0 Add a maintenance script to create bot passwords.
This is useful in testing environments where we want to spin up new mediawiki
instances and configure them programatically.

Change-Id: Ice94b67cb8775786a754de51010e78211954b2b0
2020-08-21 07:25:33 +00:00
C. Scott Ananian
34808c011a Remove ParserBeforeTidy hook, deprecated in 1.35
Bug: T198214
Change-Id: I2c8587862a4a7e4f0fe6007894edb1a0d38816e3
2020-08-12 17:45:45 -04:00
Máté Szabó
90c2840cca UserEditTracker: Do not try to initialize edit count in read-only mode
The method UserEditTracker::getUserEditCount (as well as the old User class
logic it replaced) calculates the user's edit count and writes it to the
database if it was not computed yet. However, it attempts this write even if
MediaWiki is in read-only mode, causing errors as this method is frequently
called on read requests as well.

As a fix, move the edit count initialization to the job queue, which will avoid
trying to open a source DB connection (and thus cause a read-only error) on
installs that do not use the DB-based job queue. This change requires a
workaround in UserGroupManagerTest.

Bug: T259719
Change-Id: I6d1c8e9038ae1f98f47bdb2495aecc21654b24c0
2020-08-06 00:50:41 +02:00
Reedy
66cc7bf101 Remove CategoryFinder class
Bug: T250572
Change-Id: I792cf30d9edc330c3a28e2e000f17d9e2dab69d6
2020-07-29 02:41:38 +01:00
jenkins-bot
1454621d09 Merge "Allow skins to override mediawiki.page.ready initialisation" 2020-07-28 20:49:20 +00:00
Peter Ovchyn
ae3104c46d Allow skins to override mediawiki.page.ready initialisation
Add 'ready.config.json' to resource
Add 'collapsible', 'sortable'  field to be possible override via hook.
In order to override setting, new hook ResourceLoaderPageReadyConfigHook has been introduced.

A new config field for search will follow.

Bug: T250851
Change-Id: I041d4a4b9114f1190f28e0283d96cd33b81f9850
2020-07-28 20:08:27 +00:00
DannyS712
f7932710ac Remove hard deprecated old SpecialPageFactory
Bug: T246141
Change-Id: I758fabccdc74ba9a20a3669643d5fffacc244116
2020-07-27 15:01:35 +00:00
jenkins-bot
777d339967 Merge "Create fallback for undefined content models." 2020-07-22 18:54:23 +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
daniel
08eb0dbc33 Remove obsolete findHooks.php script.
This maintenance script was obsolete in two ways:
* it tries to parse docs/hooks.txt, which no longer lists hooks.
* it searches for calls to Hooks::run, which has been replaced by
HookRunner.

The purpose of the script, namely listing hooks defined in core,
is covered by the fact that HookRunner implements all hook
interfaces.

Bug: T257804
Change-Id: I6313fe2f4366e09f0408d4d698cf92e8ff792a47
2020-07-17 12:31:08 +01:00
daniel
39cbb504bb Remove the obsolete populateContentModel script.
The script is broken in 1.35, since it operates on the rev_content_model
and ar_content_model fields which have been removed.

Bug: T258139
Change-Id: I172c83931a322a908ea8445c883b9333268ceac8
2020-07-16 12:11:39 +02:00
jenkins-bot
e9ad97eead Merge "Add watchlist expiry support to applicable APIs" 2020-07-14 04:37:44 +00:00
MusikAnimal
6a898faed2 Add watchlist expiry support to applicable APIs
This introduces an ApiWatchlistTrait that refactors out common code
across APIs that allow you to watch pages. Some methods have been
migrated from ApiBase and changed completely, but codesearch suggests
they aren't being used outside the API modules in this patch.

Bug: T248512
Bug: T248514
Change-Id: Ia18627b9824dca81f44f0571e8420d89b7626cf6
2020-07-13 18:18:15 -04:00