Commit graph

93037 commits

Author SHA1 Message Date
Tim Starling
673d496f2d Have Database::addQuotes() pass through bare integers without quoting
Quotes started being added to integers in r4984 (August 2004). Before
that, is_numeric() was used to determine whether to add quotes, so
quotes were omitted from numeric strings, which is obviously wrong.

The idea here is to use the type of the variable to hint to the database
as to whether quotes are needed. The results are somewhat inconsistent,
since some callers do not convert numeric strings obtained from user
input to integers. That makes it a more conservative change. Callers can
opt out of unquoted integers by casting them to string.

The reason for doing this is that quoting integers turns out to be not
as harmless as originally assumed. We found a case of it confusing the
MariaDB query planner, causing inappropriate indexes to be used.

I also made addQuotes() consistently return a string, instead of
returning an integer for boolean values. This was already the case for
MySQL, but it seems like a good idea everywhere.

Bug: T238378
Change-Id: I70473280f542ee5ecd79e187f580807410fbd548
2019-11-18 11:40:28 +11:00
jenkins-bot
66f34f56db Merge "Remove unused file mediawiki.special.preferences.styles.css" 2019-11-14 21:38:36 +00:00
jenkins-bot
171fcf102f Merge "Special:Preferences: Use default message block colors" 2019-11-14 21:07:29 +00:00
Bartosz Dziewoński
65cfccc213 Remove unused file mediawiki.special.preferences.styles.css
Replaced by mediawiki.special.preferences.styles.ooui.less.
Follow-up to dcf3eb793a.

Change-Id: Ia2c5a6812ad2ba1bb3a2b099c89f68331ba113a7
2019-11-14 21:50:47 +01:00
Volker E
8d71e91a2a Special:Preferences: Use default message block colors
Also change none shared email block message to notice type.

Change-Id: Icb3eafa1236d2efab9b27a1939c25070902326a8
2019-11-14 21:46:21 +01:00
jenkins-bot
047efca8e1 Merge "WikiPage: Reduce locking in doUpdateRestrictions()" 2019-11-14 18:58:31 +00:00
Máté Szabó
613fd6529d WikiPage: Reduce locking in doUpdateRestrictions()
The WikiPage::doUpdateRestrictions() method is responsible for updating
the page_restrictions table when protection settings are modified for a
given page. Currently, it unconditionally issues a query to delete existing
rows associated with the page being modified - using the page ID reference
stored in the table's pr_page field - even if such rows may not exist.
On MySQL and derivatives, this statement will create a gap lock if no rows
were found.

This can cause a deadlock if another thread then attempts to manipulate
protection settings for a different page ID that falls into the same gap.
The contending thread will likewise issue a query to delete existing
protection rows for the other page ID, which will create a gap lock on the
same page ID gap. At this point, neither thread can proceed with inserting new
protection settings for their respective pages due to the gap lock held
by the other, and a deadlock occurs. Report details in T214035 indicate that
this error condition can be observed when running mass protection scripts
operating on user and user talk pages.

This patch aims to reduce locking by first querying for existing rows in the
page_restrictions table associated with the page ID whose protection settings
are being changed, then deleting those rows based on their autoincrement pr_id
primary key value. This will not attempt to delete rows that do not exist,
thereby avoiding a gap lock.[1]

---
[1] https://dev.mysql.com/doc/refman/8.0/en/innodb-locks-set.html

Bug: T214035
Change-Id: Id796df6263362839bfe80b32d5e0582dbd5db9bb
2019-11-14 15:20:21 +00:00
Thalia
c0ce43bf5a Allow HTMLUsersMultiselectField to limit number of selected items
Bug: T238240
Change-Id: Ia2c046f3385ca0908f8c2756ba5f304ed8bed29d
2019-11-14 11:59:50 +00:00
jenkins-bot
b61bf7508c Merge "Improve error message for HTML multiselect fields" 2019-11-14 11:52:36 +00:00
Brad Jorsch
fd72284446 LogPager: Add IGNORE INDEX to avoid another MariaDB optimizer bug
This is very similar to I53a7ed59 (T223151). In that bug it was choosing
the `times` index when it should have used `actor_time` due to a
non-empty performer. This time it's choosing `times` when it should be
using `type_time` due to a non-empty set of types being queried.

Bug: T237026
Change-Id: I02c77dde6b5b54d7bea801135051b006d39459b0
2019-11-14 09:58:33 +00:00
Translation updater bot
30e46b8d66 Localisation updates from https://translatewiki.net.
Change-Id: Idb3b3f0bb759a85f90ed575e25f151cf6df12d82
2019-11-14 08:53:55 +01:00
Thalia
84552a9814 Improve error message for HTML multiselect fields
Introduce a more specific message for when the number of selected items
exceeds the maximum number allowed.

Change-Id: I359b65ac397b4acef32940ff8ff9af33651f7a7b
2019-11-14 04:57:35 +00:00
jenkins-bot
147d6d3f70 Merge "special.version.css: Replace problematic BIDI attribute with dir" 2019-11-13 23:30:06 +00:00
Umherirrender
b1a38362f3 Add missing @param and @return to documentation
Using @see is not enough description

Enable the php sniffs for now, but skip /tests/ to fix it later.
That avoids new issues in future patch sets

Change-Id: I49cb341a2880bfaeefb6bbfbb1717051ea3a4b16
2019-11-13 17:26:55 +01:00
Brad Jorsch
f5b78e9c31 cleanupUsersWithNoId.php: Handle missing fields
The maintenance script might be run to clean up users with no ID in the
`revision` table even after the other tables have had the ID and name
fields removed (in favor of the actor ID fields). Handle this situation
so as to not error out.

Bug: T238043
Change-Id: Ie84dab4218d816106bf4b0e61f020148730220f0
2019-11-13 08:40:52 +00:00
jenkins-bot
dc87130ae5 Merge "More backwards compatible changes for PHPUnit" 2019-11-13 08:35:34 +00:00
Translation updater bot
f3249dcd0b Localisation updates from https://translatewiki.net.
Change-Id: I4e3204d60606c2823113963e5aef15f8a68f97a5
2019-11-13 08:36:02 +01:00
jenkins-bot
40b28c73a7 Merge "ParamValidator: Use MessageValue!" 2019-11-13 06:15:51 +00:00
jenkins-bot
4b19ef70b4 Merge "Rewrite cdb.php to use Maintenance" 2019-11-13 02:31:32 +00:00
jenkins-bot
097ad02261 Merge "REST compare: bundle section offset information" 2019-11-13 01:18:01 +00:00
Max Semenik
e14fa40ecd More backwards compatible changes for PHPUnit
The change in XmlTest is because PHPUnit 8 messes with serialization
settings.

Bug: T192167
Change-Id: I5c9358d7cfc451845e01fca67c8d15add4039dae
2019-11-12 17:07:23 -08:00
jenkins-bot
320b350436 Merge "Use ctype_digit() instead of regular expressions" 2019-11-13 01:06:24 +00:00
jenkins-bot
791e027b2c Merge "title: Update documentation for ambiguous mw.Title.getName()" 2019-11-12 22:50:39 +00:00
jenkins-bot
8e0ca0e703 Merge "Move a lot of libs tests to the unit test directory" 2019-11-12 22:46:18 +00:00
Thiemo Kreuz
95ecacaa2a title: Update documentation for ambiguous mw.Title.getName()
I find the word "name" very much ambiguous. Here it means "file name
without extension".

I checked and found these methods are suprisingly often used by accident,
in cases where stripping an arbitrary substring from titles that contain
one or more dots would actually lead to errors. A much better name for
the method would be getNameWithoutExtension(). This would prevent such
mistakes from happening, but would be a breaking change. For now, I
suggest to update the documentation to make the difference in behavior
much more obvious.

Change-Id: Iecda9e51841b8570468f691376e3b44c272f79eb
2019-11-12 22:36:04 +00:00
jenkins-bot
5b5a4ff2ac Merge "Replace some oldskool @see with @inheritDoc" 2019-11-12 22:19:00 +00:00
jenkins-bot
e6bfcb2b66 Merge "Streamline/fix code by using short ?: and ?? syntax" 2019-11-12 22:18:54 +00:00
jenkins-bot
b24fffd3e2 Merge "Remove extraneous semicolons in unintended places and DOCUMENT!" 2019-11-12 21:39:46 +00:00
jenkins-bot
c20c2afc7b Merge "Replace duplicate jQuery.attr() with removeClass()" 2019-11-12 19:47:03 +00:00
jdlrobson
5128caa3e5 Remove extraneous semicolons in unintended places and DOCUMENT!
The contributions and history page was showing some semicolons in unexpected places.
These unwanted semicolons are now supressed by reverting to a new standalone element
in exactly the same place as the previous semicolon. This avoids the issue of
ordering that we hit before.

I have documented the behaviour of the semicolon separator in contribpager pages
My seemingly harmless change in Ic4508788299a13c4c830f447141d17d99ebe002e

For future generations I have encapsulated what I've learned in extensive
comments which seem important given the information I have acquired while
working on this patch.

Bug: T233649
Change-Id: I9723ead1815685a9cbcccf2c4e2f3ffff36dcee3
2019-11-12 09:24:47 -08:00
Volker E
5c8afc694d RCFilters: Fix bleeding background
Bug: T237504
Change-Id: Ied217da99b88c0ac43151b682c89b5d486c5184f
2019-11-12 08:17:44 -08:00
jenkins-bot
98da535e43 Merge "Clean up Title::isSingleRevRedirect() and improve atomicity" 2019-11-12 11:26:16 +00:00
brendajerop
1e06cd907d Modify apihelp to include info about revision deleted parameters
Currently apihelp doesn't mention that if you query information
about revisions, e.g a user that made a certain revision,
the response will be "userhidden". This commit includes that information
in modules API:Revisions, API:AllRevisions, API:DeletedRevisions,
API:RecentChanges, API:UserContribs, API:Watchlist, API:ImageInfo
and API:Compare.

Bug: T186573
Change-Id: I579f0d8c8183d5b158b9d3c9d6ae58e99984e58c
2019-11-12 11:03:53 +00:00
Aaron Schulz
56e17349e0 Clean up Title::isSingleRevRedirect() and improve atomicity
Bug: T235956
Change-Id: I5d23eb8ed34a3de778aa390bb07da610a7c1c94d
2019-11-12 10:57:40 +00:00
jenkins-bot
5689296376 Merge "Update wikimedia/assert from v0.2.2 to v0.4.0" 2019-11-12 08:28:49 +00:00
Translation updater bot
4b904fb748 Localisation updates from https://translatewiki.net.
Change-Id: I14de989fb271a662391b6aefc9c0fb210538664b
2019-11-12 08:42:42 +01:00
Max Semenik
ee1af9bc72 Rewrite cdb.php to use Maintenance
Change-Id: Ia3fbfbe2e89401d867f457b89a19bebdced5dd3a
2019-11-11 20:17:40 -08:00
Max Semenik
5bf93709f4 Move a lot of libs tests to the unit test directory
Change-Id: Ie7eb1016cd735f07b00524815598581e0d485f2a
2019-11-11 17:53:56 -08:00
jenkins-bot
8b92664c7c Merge "mediawiki.deflate: Remove 'easy-deflate.deflate' module" 2019-11-11 17:01:35 +00:00
jenkins-bot
91e625c064 Merge "Remove unneeded return from MWHttpRequest::setCallback" 2019-11-11 11:28:37 +00:00
jenkins-bot
891188de83 Merge "deleteTag.php: Fix batching" 2019-11-11 11:13:14 +00:00
Thiemo Kreuz
cf42131019 Streamline/fix code by using short ?: and ?? syntax
Change-Id: I27dc0c8a1a184571ed96abdea22af953510457cd
2019-11-11 11:17:13 +01:00
Thiemo Kreuz
49dc556d43 Replace duplicate jQuery.attr() with removeClass()
Change-Id: Ief2acad653c4432ee9e45a1d26f6f8dfb6f64c7d
2019-11-11 10:12:36 +01:00
Translation updater bot
6ac295cea5 Localisation updates from https://translatewiki.net.
Change-Id: I102cbade8fd2c9a95a11ace51dd85f7b966a0d97
2019-11-11 08:32:49 +01:00
Max Semenik
3aab62ce11 deleteTag.php: Fix batching
* For some reason, deletion didn't go beyond the first batch in
  beta. Simplifying the check, removing the reliance on affectedRows().
* If the last deletions were the same number as the batch size, the
  script went for the second loop, feeding an empty array of IDs to
  delete(), causing an exception.

Change-Id: Id793aeef0517041a0216110abd8b64ec85deff1e
2019-11-10 22:30:00 -08:00
Reedy
8de3b4d168 Update wikimedia/assert from v0.2.2 to v0.4.0
Change-Id: I82f87c0518ed080f4d4e3a434abb18df83e44d3d
Depends-On: I9a4734504556bae4f592251880c3d01b2dab0823
2019-11-11 06:17:49 +00:00
Reedy
d3db29e433 Update jakub-onderka/php-console-highlighter from v0.3.2 to v0.4
https://github.com/JakubOnderka/PHP-Console-Highlighter/releases/tag/v0.4
https://github.com/JakubOnderka/PHP-Console-Highlighter/compare/v0.3.2...v0.4

Change-Id: I991275b9c11b133d6f3c3bcb8ca24096a29205a8
Depends-On: Id1bc3ecf62c5c33312ac1ea038dc4ce213efde56
2019-11-11 06:10:44 +00:00
Tim Starling
8299d7ae8f REST compare: bundle section offset information
Bug: T236964
Change-Id: Ib97b0fa0de682404fb9df2ecef55a3526c54a31f
2019-11-11 16:25:35 +11:00
Umherirrender
337ecb0514 Add missing @param and @return to documentation
Change-Id: Ibc5849cc8ea7e7c4eb30ded9c1cfa5f52187c377
2019-11-10 22:12:58 +00:00
jenkins-bot
056492a6a2 Merge "Remove PHPUnit4And6Compat from Test classes" 2019-11-10 17:14:29 +00:00