Commit graph

919 commits

Author SHA1 Message Date
jenkins-bot
1f163231a6 Merge "Rehabilitate DateFormatter" 2019-04-11 06:45:16 +00:00
jenkins-bot
0d58c1ddda Merge "jobqueue: add GenericParameterJob and RunnableJob interface" 2019-04-10 16:07:09 +00:00
Tim Starling
76ca6c9b18 Rehabilitate DateFormatter
This code is surprisingly little changed since I added the class in
November 2003, and needs some modernisation.

* Remove the "linked" option, unused since 1.21. Similarly, make the
  "match-whole" option implied. This allows the regexes to be
  simplified. Nothing will be broken, according to CodeSearch.
* Instead of ucfirst(), use the canonical month name from the language.
  This will work with e.g. French which does not capitalise month names.
* Stop caching DateFormatter instances in APC. Caching was added
  in 2005 when initialisation was being done on every request, but now
  it is only needed when parsing a page with {{#formatdate}}, which is
  rarely, and the constructor overhead is only 200µs after Language
  object data initialisation. Instead, use an in-process cache via a
  factory service.
* Add docs and extra tests.
* Remove todo note obsolete since 38 minutes after the original commit.
* Rename many variables.
* Use double-slash comments
* Don't store the Language object, just get arrays.
* Use mb_strtolower() instead of Language::lc() -- any customisation of
  Language::lc() would break PCRE case-insensitive matching.
* Use named subpatterns instead of "keys"
* Remove the ISO1/ISO2 distinction, the only difference was linking.
* Use closure variables instead of temporary object members

Change-Id: I25fb1203dba2930724d7bc28ad0d51f59f88e1ea
2019-04-10 21:00:04 +10:00
Aryeh Gregor
76661cf129 NamespaceInfo service to replace MWNamespace
MWNamespace::clearCaches() has been removed entirely, along with the
$rebuild parameter to MWNamespace::getCanonicalNamespaces(). The rest of
MWNamespace is deprecated.

Diff best viewed with -C1 so git notices that NamespaceInfo is a copy of
MWNamespace.

Depends-On: Icb7a4a2a5d19fb1f2453b4b57a5271196b0e316d
Depends-On: Ib3c914fc99394e4876ac9fe27317a1eafa2ff69e
Change-Id: I1a03d4e146f5414ae73c7d1a5807c873323e8abc
2019-04-10 02:07:36 +00:00
Aaron Schulz
fc5d51f129 jobqueue: add GenericParameterJob and RunnableJob interface
Simplify the code of jobs that do not care about titles and removes
the direct Title dependency from JobQueue. Remove getTitle() from
IJobSpecification itself. Move all the Job::factory calls into a
single JobQueue::factoryJob() method.

Depends-on: Iee78f4baeca0c0b4d6db073f2fbcc56855114ab0
Change-Id: I9c9d0726d4066bb0aa937665847ad6042ade13ec
2019-04-08 11:05:23 -07:00
Zoranzoki21
26faca6a20 Move PackedHoverImageGallery from PackedOverlayImageGallery.php
Change-Id: I7a764fa89637dc7c3865dbbbbe0d90d5bc268ed2
2019-04-06 14:12:02 +02:00
Aaron Schulz
eb603040de rdbms: add and enforce DB_REPLICA/DB_MASTER roles in DBConnRef
Even if there is only one database, if a DB_REPLICA connection
reference is obtained and an attempt is made to write it then
it will still fail. This can make it easier to spot incorrect
database usage even in a simple vanilla developer environment.

Note that methods like ILoadBalancer::getConnectionRef() can
be used for local connections as well as foreign ones.

Change-Id: I5523daad1bdd64624d3e0dd41bfd8d078b1078b0
2019-04-05 09:03:50 +00:00
jenkins-bot
f28f7a0d0f Merge "jobqueue: remove entire unused JobQueueAggregator class hierarchy" 2019-04-03 17:43:31 +00:00
Filippo Giunchedi
e783e152a2 monolog: add MwlogHandler
Introduce a new handler, similar to SyslogHandler, that will be used to
replace udp2log. The main feature of the handler is being able to vary
the 'application name' with each record's channel. This way the channel
can be reconstructed later, e.g. when writing to plaintext files.

See also an overview of the plan here:
https://phabricator.wikimedia.org/T205856#4957430

Bug: T126989
Change-Id: I0c040825b31cd70f197dc8c1d406a103dc0ed1d1
2019-04-02 04:57:04 +00:00
Umherirrender
b233e9d188 Move MediaTransformOutput classes to own files
Change-Id: I1c676f18101250ffc28ea412213d568c5a4f527d
2019-03-30 12:23:14 +01:00
Aaron Schulz
196ef348c5 jobqueue: remove entire unused JobQueueAggregator class hierarchy
Change-Id: I3d56d5db54fcb4278c7cf2a8d08933c27773c3f7
2019-03-29 20:25:05 -07:00
Umherirrender
6745cb572a Move class SearchEngineDummy to own file
Each class should have its own file, even it is a no-op

Change-Id: I90124ed35e354c546fcd69d52dc1febb71b2c71f
2019-03-29 20:35:35 +01:00
Aaron Schulz
7ff25118ee rdbms: move some files under rdbms/database to subfolders
Change-Id: I627398d2cfe9fda93a16f94a94e75cf5f8833613
2019-03-28 16:22:07 -07:00
jenkins-bot
670cd4802b Merge "Move PrefixSearch classes to own files" 2019-03-28 21:42:50 +00:00
Krinkle
22476334be Merge "resourceloader: Improve test cases for MessageBlobStore" 2019-03-28 20:37:42 +00:00
jenkins-bot
26fbddd78c Merge "Move HistoryBlob classes to own files" 2019-03-28 10:55:48 +00:00
Timo Tijhof
853a291903 resourceloader: Improve test cases for MessageBlobStore
Move source code to includes/resourceloader to match
test case. This is part of ResourceLoader and not meant
to be used elsewhere.

Merge two similar test cases for getting blobs and fetching
messages which were doing the same thing.

Rewrite the test names to be a better reflection of the stories
they test, add comments for why, and re-order them to put related
tests together.

Move test-utilities to the bottom and make them actually private.

Change-Id: I7a437eebf3ba6a722e286dfe77c2f9fe49ad222f
2019-03-27 23:53:23 +00:00
Umherirrender
8d5a8fb181 Move PrefixSearch classes to own files
Move all into search subfolder

Change-Id: I4097b9745d22545afe6761da1fa67cf98af5b811
2019-03-27 21:40:33 +01:00
jenkins-bot
38760fe587 Merge "resources: Make manageForeignResources a regular maint script" 2019-03-25 20:04:08 +00:00
Umherirrender
7ede3c619a Move HistoryBlob classes to own files
Move all into own subfolder

Change-Id: Iccf1bb9a2c8927c1b4dc0952d59d745109a71f76
2019-03-25 20:29:47 +01:00
Umherirrender
c71a50e2a0 Rename PoolCounter_Stub to PoolCounterNull
Also move to own file
Remove "Stub", because it refers a php concept,
which is not used here

Change-Id: Ife952901b5ad8e4a408d229ee72de953a9acc220
2019-03-24 22:44:46 +01:00
Timo Tijhof
f8fcff31aa resources: Make manageForeignResources a regular maint script
The maintenance script was previously in a subdirectory which
is a bit unusual. It's now a regular maintenance script,
with the YAML file in a more discoverable place as well.

Change-Id: I38690f23dbe89839bee0e1d43ecfd68adeb19c0f
2019-03-24 20:57:46 +00:00
jenkins-bot
b9789f9c56 Merge "add lbzip2 output processor for exports" 2019-03-23 23:35:29 +00:00
Ariel T. Glenn
b01ff36537 add lbzip2 output processor for exports
Bug: T214293
Change-Id: I98e26b833df473bbeb3dc1b881f428174d776b64
2019-03-24 01:20:04 +02:00
jenkins-bot
e548897cab Merge "Move class RevisionListBase and friends to own file" 2019-03-23 22:37:10 +00:00
Timo Tijhof
6b7ddf9c9b Revert "Split out new RefreshSecondaryDataUpdate class"
This reverts commits a1f7fd3ada, 0ef02cd018.

Bug: T218456
Change-Id: I9bbea3d13460ed44755d77fc61ff23fb906cf71e
2019-03-19 14:51:27 +00:00
Piotr Miazga
fd24be4fc5 Provide a Taggable interface
The Taggable interface defines how to tag objects in MediaWiki.
For now there are only two Taggable objects:
 - RecentChange
 - ManualLogEntries

This interface should be used in places where we want to optionally
tag things, for example:
 We want to tag all mobile web actions with 'web mobile edit'.

With that interface, we will be able to expect a Taggable object,
and call `addTags()` when we need to, without having a special check
to verify is it RecentChange, or is it ManualLogEntry. We will only
expect a Taggable object.

Additionally, added @deprecated note to ManualLogEntries::setTags()
as each call to this method will override all previous tags. This
action can be harmfull to parts of code that conditionally add tags.
If object was tagged in some way, we should preserve those tags.

If there are any special cases, where we want to override all tags,
we should provide `resetTags()` method.

Bug: T215675
Change-Id: Ia4c019db8ca6f37ce0f86bf7d134d6f1713daf56
2019-03-18 23:10:06 +01:00
Timo Tijhof
4677392718 Remove wgSitesCacheFile and rebuildSitesCache.php (unused)
This seems to have been intended as optimization for SiteStore,
but was never used as far as I can tell. Instead, SiteStore is
already cached via LocalServerCache (APC).

Keep the FileBasedSiteLookup class for one release cycle in case
third parties not indexed by MediaWiki Codesearch are using it.

== History

* 2013: Report of high memcached usage by Wikibase via SiteStore.
* 2014: Lazy-load the data in Wikibase (d3f2e99cb6).
* 2014: Implement the file-based cache (via T47532 and 90f6efc360).
* 2015: Use local-server cache (APC), per T58602.

The file-based code was never used. The related task marked
invalid (T47532).

Change-Id: I8e2d9edcf3880149f824cc3de37793ca57435b49
2019-03-15 20:03:44 +00:00
Aaron Schulz
a1f7fd3ada Split out new RefreshSecondaryDataUpdate class
Make DerivedPageDataUpdater bundle all the related DataUpdate tasks
on page change with a RefreshSecondaryDataUpdate wrapper. If one of
the DataUpdate tasks fails, then the entire bundle of updates can be
re-run in the form of enqueueing a RefreshLinksJob instance (these
jobs are idempotent). If several of the bundled tasks fail, it is easy
for DeferredUpdates to know that only one RefreshLinksJob should be
enqueued.

The goal is to make DataUpdate tasks more reliable and resilient.
Most of these deferred update failures are due to ephemeral problems
like lock contention. Since the job queue is already able to reliably
store and retry jobs, and the time that a regular web request can spend
in post-send is more limited, it makes the most sense to just enqueue
tasks as jobs if they fail post-send.

Make LinkUpdate no longer defined as enqueueable as RefreshLinksJob
since they are not very congruent (LinksUpdate only does some of the
work that RefreshLinksJob does). Only the wrapper, with the bundle of
DataUpdate instances, is congruent to RefreshLinksJob.

This change does not itself implement the enqueue-on-failure logic
in DeferredUpdates, but is merely a prerequisite.

Bug: T206288
Change-Id: I191103c1aeff4c9fedbf524ee387dad9bdf5fab8
2019-03-15 17:14:50 +00:00
Umherirrender
3265bbb184 Move class RevisionListBase and friends to own file
Change-Id: I2c3675286bef948585ee0364288081aad9fd4376
2019-03-14 19:50:40 +01:00
jenkins-bot
c4022f1e98 Merge "Move class HistoryPager to own file" 2019-03-10 03:25:36 +00:00
Umherirrender
9d5e2fd751 Move class RangeDifference to own file
Change-Id: I5262c7484017a0d920cc24297515d5946f614ee6
2019-03-08 23:29:14 +01:00
Umherirrender
ba03d8f32a Move CacheDependency classes to own files
Change-Id: Icacf36674f10fa19a09499d68d596d5e2cc235f0
2019-03-08 22:27:29 +01:00
Umherirrender
11ce0ab99b Move class HistoryPager to own file
Change-Id: Ie12e79e6f32225442b5bd794826f8c760b2c02d6
2019-03-08 21:56:38 +01:00
Umherirrender
d515f784e5 Move class JobQueueAggregatorNull to own file
Change-Id: Icb76f25eb9c2a26c91ba564a78edd4c07b49b944
2019-03-08 20:19:26 +01:00
James D. Forrester
3f717984c1 Drop AuthPlugin and related code, deprecated in 1.27
Bug: T215843
Depends-On: Ie49709faa6f67b0a31bd546823d29dbfea0a70eb
Depends-On: If8109dbfdeeb88a6265f4cd79d1ae81bff48d934
Depends-On: I36b195fa2d6c23a76631ebaf869c787e44427d60
Depends-On: Iaa171b085fde331eab7d85c7de74523e27fc625a
Change-Id: I330b30d6582034a233fed204c0680b1ce84eec6e
2019-03-05 08:23:14 +00:00
Umherirrender
7edafc29c6 Move specialpage redirects related classes to own files
Change-Id: Ibddbb0c4e40fff310b1720ec9c72f2683cc93f54
2019-03-03 17:59:24 +00:00
Umherirrender
8d52cf3d12 Move FauxResponse class to own file
Similar to FauxRequest

Change-Id: Ia9e4e7287ade605899d935db7c9f1f017e0bcb85
2019-03-02 18:55:13 +00:00
Amir Sarabadani
f8efd21621 Fix lowercase in namespace of LogCapturingSpi.php
Basically turning Mediawiki to MediaWiki as all other classes exist
in that namespace

Bug: T217128
Change-Id: I95039a1a54c9900a2f2414b5a6ccce5fb6e5e612
2019-02-26 13:17:09 +01:00
jenkins-bot
dd35e1a469 Merge "Print logs generated during unit test when test fails" 2019-02-22 08:01:16 +00:00
Max Semenik
292e13edc5 Add support for Argon2 password hashing
So far, everything we had was vulnerable to newest advances in
GPU cracking and timing side-channel attacks. Argon2 was designed
specifically to address these problems.

Unfortunately, PHP support is lagging, with some builds missing
Argon2id or even Argon2i.

Change-Id: Ifdf648f5d8a734a663e630286724a6d0a87c7510
2019-02-10 02:20:52 -08:00
Matěj Suchánek
93aeb14e08 Move migrateActors.php to includes
This way it can be subclassed in extensions, like AbuseFilter
(Ic755526d5f989c4a66b1d37527cda235f61cb437).

Bug: T188180
Change-Id: Idf320232011c72e39267b1f3c39848aea35d37fe
2019-02-09 11:42:38 +01:00
James D. Forrester
edba8aaf5a Drop SiteSQLStore, deprecated in 1.27, unused
Change-Id: I6743417c3aafbba59ac02350e0190fbf688a5a40
2019-02-08 17:43:33 -08:00
Roan Kattouw
1c7c9bdf1f Use packageFiles feature to replace special-purpose RL modules
For config vars, add a virtual package file called 'config.js', and use
require( './config.js' ) in the module. For most data modules, add a
virtual package file called 'data.js', use require( './data.js' ) in the
module. Where needed, add wrapper files that put the data in the
relevant global object and in module.exports.

LanguageDataModule is the only special-purpose module not being removed
in this commit, because it uses languageScripts, and those are not
compatible with packageFiles (yet).

Also merge mediawiki.ForeignStructuredUpload.config into
mediawiki.ForeignStructuredUpload, since that was the only thing that
used it.

Change-Id: I203d4e3ecdeeeb16729eba2dcf40d11a41d2e582
2019-02-09 00:10:48 +00:00
Erik Bernhardson
56ffbc2a4e Print logs generated during unit test when test fails
When a unit test fails it is possible, perhaps even likely in some
cases, that some code that was run logged useful information about
how that failure came to be.

Help people out, tell them what happened!

Change-Id: I30bbc31799a65024868678d052fec9aafacc1aff
2019-02-06 14:43:32 -08:00
Umherirrender
b0a75622d3 Move upload stash related exceptions to own files
Change-Id: I23e81af2f1bf73f5cd78a01bcc2fcebb4c4ea038
2019-02-06 22:22:01 +01:00
Umherirrender
fa29c3c09d Move exceptions JobQueueError to own file
Change-Id: Ibd67358cb7a14497dce8a3982ceba3b4300bdd65
2019-02-06 19:39:20 +01:00
Umherirrender
6ebe568c4e Remove deprecated class SquidUpdate
Change-Id: Iac53864296990befe7c573a29dd2f35aca52a79e
2019-02-05 20:35:05 +01:00
Umherirrender
1c851623b0 Move interface ICacheHelper to own class
Change-Id: I6f2b6507b0038f0988e4db5566ebddbe0d734a70
2019-02-05 20:04:12 +01:00
Umherirrender
1ca06c64af Move interface IJobSpecification to own file
Change-Id: Iabb10f8473b2ef0f4aea2aaca0dad39745028ece
2019-02-04 21:04:12 +01:00