Commit graph

9144 commits

Author SHA1 Message Date
Timo Tijhof
de4276cbc5 Storage: Disable NameTableStoreTest case that fails on sqlite
To unblock T246358.

Bug: T246358
Bug: T259085
Change-Id: Icddb6eae411eed5658ba942b2271fc6469659251
2020-07-29 00:45:14 +00:00
jenkins-bot
8991f53965 Merge "REST /page/{title}: Fix title encoding." 2020-07-28 19:09:48 +00:00
jenkins-bot
df0635ac0c Merge "/contributions/user/{user}/count" 2020-07-28 19:09:43 +00:00
jenkins-bot
9266de4f6d Merge "filebackend: Fix index error in SwiftFileBackend" 2020-07-28 18:52:34 +00:00
Nikki Nikkhoui
3ba476102d /contributions/user/{user}/count
REST Endpoint for getting the number of contributions for a given
user (not yourself).

Change-Id: Ib3bfedcec0aa1af1983cec0a7bda28fc49ddc673
2020-07-28 18:36:41 +00:00
Umherirrender
b3e782ddbd Fix unit test in SpecialRecentchangesTest for postgres
Use Database::timestamp
Also pass function name for debugging

Bug: T259026
Change-Id: Id642976ed1d7f275abd90d6ec0e5d492b85d0c9a
2020-07-28 17:30:24 +02:00
Thiemo Kreuz
81362c930f filebackend: Fix index error in SwiftFileBackend
This fixes a regression introduced by If3d2f18.

Bug: T259023
Change-Id: I654b1bcf0ff65f68ed7d92d51a6b39325da731f3
2020-07-28 15:30:53 +02:00
Sam Wilson
1342c90537 Fix watchlist query and filters for RecentChanges
This query was correctly excluding expired items from RC, but it
was failing to include them when the unwatched filter was set.

This is a follow-up to https://gerrit.wikimedia.org/r/c/mediawiki/core/+/602211

Bug: T252136
Change-Id: I5d43d746df21cc3674eb2e92c3f604b7c87b7d1a
2020-07-28 08:38:25 +08:00
jenkins-bot
16f2a01b6a Merge "Rest: Handle Uri constructor exception" 2020-07-27 22:40:51 +00:00
DannyS712
f7932710ac Remove hard deprecated old SpecialPageFactory
Bug: T246141
Change-Id: I758fabccdc74ba9a20a3669643d5fffacc244116
2020-07-27 15:01:35 +00:00
DannyS712
ac66469a6d Remove hard deprecated ApiTestCase::doLogin
No known uses in any repo on codesearch:
https://codesearch.wmcloud.org/search/?q=doLogin%5C(&i=nope&files=&repos=

Bug: T245355
Change-Id: I606d4f922a3034af786cf64e6d8b211cd12a09af
2020-07-27 14:35:14 +00:00
jenkins-bot
6661a3334f Merge "Fix parser test class naming" 2020-07-24 19:09:57 +00:00
Thiemo Kreuz
9c6473dc1d Reduce nesting by turning big if-else into guard clauses
Change-Id: If3d2f18af0cc7d0f8fe9f764bd4d0e4bae70e440
2020-07-24 11:55:31 +02:00
C. Scott Ananian
7101c981b2 Fix parser test class naming
This isn't really user visible, but the algorithm for ensuring there
are no conflicts in automatically-generated parser test class names
had a number of issues which led to inconsistent naming.

Change-Id: I50ff5b72381332c77f0d99af08e689796019a7af
2020-07-24 00:29:12 -04:00
daniel
d2d2906ce7 REST /page/{title}: Fix title encoding.
Page titles used in URL paths, such as the Location header returned
after a page was created, must use the correct encoding for spaces and
pluses.

Bug: T258606
Change-Id: I75e91ac8f8da4eb183a9c8f1a682ea08c2225227
2020-07-23 23:17:17 +02:00
jenkins-bot
75c9333ddb Merge "Fix broken PHPDoc comments that don't start with /**" 2020-07-23 19:04:42 +00:00
Thiemo Kreuz
fd7363a1e1 Fix broken PHPDoc comments that don't start with /**
Change-Id: I8db56ff0f73873864dde260e51adcd729aa74e94
2020-07-23 16:09:41 +00:00
jenkins-bot
f80018225f Merge "Cleanup up excess commit() call in LocalRepoTest" 2020-07-23 03:19:08 +00:00
Aaron Schulz
dc388e6c16 Cleanup up excess commit() call in LocalRepoTest
Bug: T256394
Change-Id: I4bdfa6f0034e36c88c337319df2b2fbacded147b
2020-07-22 16:22:01 -07:00
Kunal Mehta
0b43c49465 Revert "Add a new type of database to the installer from extension"
It caused a 20% latency regression by unconditionally parsing extension.json
files on every single load instead of using the existing caching
infrastructure. There are further problems with the use of parsing/loading
extension.json files in a method that is incompatible with the existing
architecture.

This primarily reverts commit 46eabe275c.

Also needed to revert 16381261ae and 7c72347ec1.

Bug: T258664
Change-Id: I34a783c3f0df0447876a26441bb2d12e02368871
2020-07-22 16:05:31 -07:00
jenkins-bot
a11df366b2 Merge "Fix scopedRegister() handler key" 2020-07-22 19:55:22 +00:00
Nikki Nikkhoui
7defcf9c15 Fix scopedRegister() handler key
Use a unique key to assign handlers registered via
scopedRegister(). Using unique keys instead of
array indices ensures that handlers registered in other
ways previously (e.g. via global hook registry or via
HookContainer::register() won't be removed).

Remove the temporary hook for AlternateUserMailer
as the ticket it references is for a class that
no longer exists

Bug: T255056
Change-Id: I491f281e60511a5bdd695ac123611e408324ccff
2020-07-22 12:24:22 -07:00
jenkins-bot
777d339967 Merge "Create fallback for undefined content models." 2020-07-22 18:54:23 +00:00
jenkins-bot
e2c07404df Merge "UserContributionsHandler: use UserFactory::newAnonymous" 2020-07-22 18:51:16 +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
4f5e7c4bfa UserContributionsHandler: use UserFactory::newAnonymous
Change-Id: Ic7d402903b63a5fba6dabd3569d9d6ee18d11b3a
2020-07-22 18:33:16 +02:00
Nikki Nikkhoui
43f2d5440f Rename 'revisions' to 'contributions'
Extensions have the ability to inject their own idea of what
a contribution is into the ContribsPager query resultset (via
the ContribsPager__reallyDoQueryHook). Because of this,
stable chronological ordering of ContribsPager results
becomes virtually impossible

For the purpose of the User Contribution REST endpoints, we will
restrict the resultset to ONLY mediawiki revisions for now.

This patch renames 'revisions' to 'contributions' and adds the
'type' field to future-proof work on adding different kinds of
contributions to the User Contribution REST endpoints.

Bug: T257838
Change-Id: I1e6de1c14a5f47e0310df86325fa6d791833addb
2020-07-22 18:29:29 +02:00
jenkins-bot
0b76ba5bb5 Merge "Add option to not call onContribsPager__reallyDoQuery hook" 2020-07-22 16:24:47 +00:00
Nikki Nikkhoui
268400fbde Add option to not call onContribsPager__reallyDoQuery hook
For some use cases (e.g. UserContributions endpoints (T235073) )
we do not want extensions to be able to inject their own
contributions into the result set of ContribsPager.

This is because extensions may not be adding revisions, but
other types of 'contributions'. With the hook enabled,
we are unable to reliably enforce strict chronological
ordering of contributions. (See T200259 for explanation).

Disabling the hook provides a consistent set of revisions for the
User Contribution endpoints.

Bug: T257839
Change-Id: I239395c572d4cb32a4d9ee871ffa02accfdce837
2020-07-22 18:00:51 +02:00
Ostrzyciel
8de0f3a883 PageUpdater: fix handling of null edits
Previously null edits were not properly marked in EditResult objects
provided by the PageUpdater. This change should fix it, by ensuring
the original revision ID is always set on the EditResultBuilder if
the edit is a null edit.

I've also added some code to test this, so we hopefully don't
encounter an issue like this in the future. :)

Bug: T257766
Change-Id: I04bb058c64483967617958d86aa40a67c31071cb
2020-07-21 12:22:33 +02:00
Nikki Nikkhoui
ccc073854c Remove unused HookContainerTest method
Remove an unused private method from HookContainerTest.

Change-Id: Ie158cef343b31209d3d6e2da57176c9049613b19
2020-07-20 09:43:59 -07:00
jenkins-bot
6e971eb257 Merge "Check for unknown slot." 2020-07-20 15:20:13 +00:00
Cindy Cicalese
c69489f44c Check for unknown slot.
Bug: T220525
Change-Id: I89ac1679ea70cb403433f8b97fe11e8eb6811280
2020-07-20 10:39:28 -04:00
jenkins-bot
1334f4e9c8 Merge "MCR import" 2020-07-20 12:34:24 +00:00
daniel
7ffacacc6b MCR import
Bug: T220525
Change-Id: I7d41a8af12e33aed802526eb39a0880292c4f534
2020-07-18 20:34:16 -04:00
jenkins-bot
4bac6e9427 Merge "Fix switch/case indentation per mediawiki coding conventions" 2020-07-18 09:42:06 +00:00
Ed Sanders
9e5ba1f4f8 Fix switch/case indentation per mediawiki coding conventions
See https://www.mediawiki.org/wiki/Manual:Coding_conventions#Indenting_and_alignment

Bug: T182546
Change-Id: Ia0dedba6f4676f3c703e3416858f445e4ade4ef6
2020-07-18 09:17:46 +00:00
suecarmol
436d7fbf06 Display remaining watch period in watchstar
Add a new tooltip message that displays the remaining watch period of a
page, if it is being watched temporarily. The tooltip message remains
the same if it is being watched indefinitely.

Bug: T250215
Change-Id: Ic9d1301427d477de71fb6f63fe77554a33684cd1
2020-07-18 01:45:51 +00:00
Ostrzyciel
435d5f4d55 Add mw-manual-revert change tag
Based on the patch that introduces manual revert detection, this is
to create a software-defined change tag that will be applied to all
edits that restore a page to an exact previous state. This is also
for consistency with mw-undo and mw-rollback that will make a
"reverted" tag appear on reverted edits in the future.

Note about the REST API tests: in the next patch in this chain
I encountered even more issues with comparing returned changed tags
with expectations, so I decided it'd better if we just checked the
change tags applied manually in these tests. Otherwise we can run into
nasty race conditions, as the reverted tag is processed after sending
the response to client in the deferred update. It also makes the test
hard to maintain.

Bug: T256001
Change-Id: Ic367886f39faedcb823222b7d63bf4d5cb236ae9
2020-07-16 13:29:12 +02:00
Nikki Nikkhoui
6c8187d4f8 UserFactory method for getting anonymous user
Create a method in UserFactory to instantiate an anonymous
user with an optional IP address.

Bug: T257464
Change-Id: I557620f9bcd4b646288b4a76b26c4730fccbc3d8
2020-07-15 00:07:45 +00:00
Ammar Abdulhamid
6fe47ee97f Fix wrong title links on Special:Undelete
The links use {{FULLPAGENAMEE}} magic word which would resolves to
'Special:Undelete' on the diff page, therefore giving wrong target
title for the logs

Bug: T196669
Change-Id: Ibcd58cea23dbca8e24b638c6f6ee5e764f32ff26
2020-07-14 20:03:16 +00:00
Thiemo Kreuz
e874f3fb17 Make WebRequest::getAcceptLang() return floats instead of strings
This is a follow-up for Ifcf0bc4.

I checked the callers of this method. The majority of them does not
care about these numeric values, only about the language codes. Most
callers even do an array_keys() immediatelly. The only effect I could
find will be visible in the ApiQueryUserInfo API module. Example:
https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&meta=userinfo&formatversion=2&uiprop=acceptlang
In this response, the numbers are currently reported as strings, but
will be reported as floats. I would argue this counts as a bugfix and
doesn't need anouncement.

This patch also splits the responsible regular expression pattern for
improved readability, utilizing the /x extended mode. No change is
made to the pattern.

Change-Id: I42de46f56d7544f9781b02a2f0ed49ef85ee44a1
2020-07-14 19:10:24 +00:00
Ammar Abdulhamid
4079d328e7 Rest: Handle Uri constructor exception
All titles that contain a colon followed by a number cannot, currently,
be accessed via the Rest endpoint.

For example https://en.wikipedia.org/wiki/3:33 is a valid title/article
on English Wikipedia and can be accessed there the index/api.php entry
points. But the rest endpoint will fatal:
https://en.wikipedia.org/w/rest.php/v1/page/3:33/history

The exception is thrown in Uri constructor of GuzzleHttp library
if parse_url() failed to parse the request URL. But parse_url() has
an open bug of failing to parse URLs that contain the above pattern.
The function returns false in such cases, (it previously raised warning
see I2715607);

To make our titles with this pattern accessible, we have to forestall
this exception.

Bug: T256831
Change-Id: Ib829afc7b33419b01e69ababa147d33b30c0fbcb
2020-07-14 16:54:29 +00:00
jenkins-bot
9341848df8 Merge "Add import/export round trip test." 2020-07-14 14:27:43 +00:00
daniel
cac44ca333 Add import/export round trip test.
This creates the infrastructure we want to use later to test
improt and export of multiple slots.

Bug: T220525
Change-Id: I8e02927bd5532fe9cee0694d48a4c7d9ec060ba1
2020-07-14 15:55:55 +02:00
Ostrzyciel
1dc2319c1a EditResultBuilder: manual revert detection
The code for manual revert detection is ran when building the
EditResult and the edit was not marked as a revert yet. It's
based on a SELECT looking for recent edits that match the new
revision's SHA1. There is no index over rev_sha1 field, so we
limit the search to N most recent edits, in order not to cause a
full table scan.

I think this shouldn't break any extensions by setting the
originalRevisionId in situations that weren't expected, almost no
extension uses that anyway:
https://codesearch.wmflabs.org/search/?q=%5C%24originalRevId&i=nope&files=&repos=

Bug: T256001
Change-Id: I4e38b382391b42e252cb66584be1e174cdfe348c
2020-07-14 15:34:57 +02:00
jenkins-bot
28f0b2cfc8 Merge "EditPage: handle undoafter param properly" 2020-07-14 13:23:04 +00: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
Bill Pirkle
8e9cba8bf0 Remove deprecated "legacy" serialization type from RESTBagOStuff
T233963 added serizalization type to RESTBagOStuff. Although
there were no known callers that were not refactored to be
aware of this, T233963 also added a deprecated "legacy" type,
marked for removal in MW 1.35, just in case. There are still no
known callers using this, so remove "legacy" as planned.

Bug: T234779
Change-Id: I0c7707692aa1d0c75e262c914e064bddc10897c7
2020-07-13 10:29:47 -05:00