Commit graph

770 commits

Author SHA1 Message Date
jenkins-bot
9dd89f539f Merge "Kill non namespaced ScopedCallback" 2018-06-01 04:35:22 +00:00
Kunal Mehta
2ecb2c944f Use wikimedia/xmp-reader library
Bug: T100922
Depends-On: I9bec4e03c49baafda30fb44cc793fa31b36e400d
Change-Id: Ic9044bf3260d1a474a6c74844949602441ffc865
2018-05-31 19:24:39 -07:00
Reedy
6a45c00742 Kill non namespaced ScopedCallback
Change-Id: I94d14e4bf60c6f3b2c359ac8da61b783f8375bd0
2018-06-01 00:30:07 +01:00
Tim Starling
25503cf011 Maintenance script to wrap the mysql binary
This is more or less equivalent to the WMF shell script "sql", but it is
reasonably portable and written in a less hackish way.

Change-Id: I240d8d4e65ce46680cac257ee376a9b026c13f92
2018-05-31 15:42:51 +10:00
Krinkle
7759b85acc Merge "Split ApiUsageException and UsageException to class per file" 2018-05-29 23:39:11 +00:00
jenkins-bot
930a808814 Merge "Split ApiMessage to class per file" 2018-05-29 22:18:24 +00:00
Reedy
d741d0d962 Split ApiUsageException and UsageException to class per file
Change-Id: I54c7d5e6616ac1a23082cc72e60ed92cb7eef715
2018-05-27 20:43:55 +00:00
Reedy
5522a7a9b8 Split ApiMessage to class per file
Change-Id: If8f51e6535d0ec6e35336a6702c5e35be35bcf09
2018-05-27 00:31:30 +00:00
jenkins-bot
468690e036 Merge "Rename ApiQueryContributions to ApiQueryUserContribs to match api module name" 2018-05-26 23:57:30 +00:00
Reedy
0be39da9b0 Rename ApiQueryContributions to ApiQueryUserContribs to match api module name
Change-Id: I865628b87eda7be349522fcfaf94f5563142026e
2018-05-26 23:07:15 +00:00
jenkins-bot
4cc846987b Merge "Switch includes/{sparql,Storage,tidy} to use the PSR-4 autoloader" 2018-05-26 22:54:11 +00:00
jenkins-bot
9a0526c8aa Merge "Switch includes/{preferences,services,session,shell} to use the PSR-4 autoloader" 2018-05-26 22:40:47 +00:00
jenkins-bot
56b38a4d1b Merge "Move includes/auth back to the standard classmap autoloader" 2018-05-25 02:23:00 +00:00
Kunal Mehta
386bd27f64 Switch includes/{sparql,Storage,tidy} to use the PSR-4 autoloader
Change-Id: I1ae3cb3833a28286eb4ae09b586785d156917e8e
2018-05-24 18:58:18 -07:00
Kunal Mehta
ec76c5b50e Switch includes/{preferences,services,session,shell} to use the PSR-4 autoloader
Change-Id: Ic095ed65d05517cdb7b383cde8c664044f790f05
2018-05-24 18:58:10 -07:00
Kunal Mehta
5cff12767e Move includes/auth back to the standard classmap autoloader
Partially reverts c587ab1375.

Change-Id: Ie8cfe356b07f08d481370b9f61b1d08ed6c9c799
2018-05-24 18:57:42 -07:00
Bartosz Dziewoński
c513ec19ef Restore 'PreferencesForm' as alias for 'PreferencesFormLegacy'
In change 4633f4d46a it was changed
to an interface implemented by both PreferencesFormLegacy and
PreferencesFormOOUI so that existing typehints for some functions
parameter would accept them both. Replace those typehints to use
HTMLForm instead. There was really no guarantee in the past that
they would only be given PreferencesForm or its subclasses, either.

Because the typehint change affects some hooks, note it as a
deprecation in MW 1.31 and a breaking change in MW 1.32.

Also add @since tags and correct some typos in code comments.

Follow-up to 4633f4d46a.

Change-Id: I61749f1d864cf68afe90cd9e15ba2d7a74252501
2018-05-24 21:20:50 +00:00
Kunal Mehta
c587ab1375 Switch includes/{auth,edit,editpage} to use the PSR-4 autoloader
Change-Id: I9210d26c1031d69f6691fef038cc2db6f391b70e
2018-05-23 19:36:51 -07:00
Kunal Mehta
a2c166cb51 Have class match filename in some maintenance scripts
Each of these scripts had a class name that was not referenced outside
of the script file itself, and are safe to rename as a result.

Change-Id: Id605aca11db51ee433baeaa998a0e33184c930ca
2018-05-23 19:36:51 -07:00
jenkins-bot
d1f826c746 Merge "Add Special:PasswordPolicies" 2018-05-19 09:26:48 +00:00
Reedy
18d21c9ba0 Add Special:PasswordPolicies
Bug: T174812
Change-Id: Ifb4876f7309a667154c7469c29e703b6c33d54af
2018-05-19 08:55:39 +00:00
Amir Sarabadani
5a21de8abb Remove everything related to CollationFa
This workaround was needed when ICU in production was broken
but after T189295 this is not needed anymore and we switched off
this collation from all Persian Wikis already

Bug: T139110
Change-Id: Ifad89555b6ac96a3eb36ca24b55e1f8ee57a1f05
2018-05-18 18:33:25 +02:00
Brad Jorsch
1c7bf1baf0
Deduplicate archive.ar_rev_id
Old bugs and such may have left the archive table with multiple rows
using the same ar_rev_id, or rows that also exist in the revision table.
These need to be cleaned up for MCR.

The maintenance script added here will delete rows that appear to be
duplicates of the same change, and will assign new IDs to rows that do
not appear to be duplicates.

Bug: T193180
Change-Id: I39b0825c9469e074ded3df33a4f06a1ef0edb494
2018-05-16 14:34:11 +02:00
Brad Jorsch
aef72c5cf6 Populate externallinks.el_index_60 and drop default
Adds a maintenance script to populate the field, has that be
automatically run during update.php, and drops the no-longer-needed
default value on the column (where possible: mssql has some sort of
constraint thing going on that I have no idea how it works).

Bug: T59176
Change-Id: I971edf013a1a39466aca3b6e34c915cb24fd3aa7
2018-05-15 12:08:35 -04:00
jenkins-bot
8e6496aaa3 Merge "Initial support for Content Security Policy, disabled by default" 2018-05-14 04:17:15 +00:00
Brian Wolff
70941efd35 Initial support for Content Security Policy, disabled by default
The primary goal here is a defense in depth measure to
stop an attacker who found a bug in the parser allowing
them to insert malicious attributes.

This wouldn't stop someone who could insert a full
script tag (since at current it can't distinguish between
malicious and legit user js). It also would not prevent
DOM-based or reflected XSS for anons, as the nonce value
is guessable for anons when receiving a response cached
by varnish. However, the limited protection of just stopping
stored XSS where the attacker only has control of attributes,
is still a big win in my opinion. (But it wouldn't prevent
someone who has that type of xss from abusing things like
data-ooui attribute).

This will likely break many gadgets. Its expected that any
sort of rollout on Wikimedia will be done very slowly, with
lots of testing and the report-only option to begin with.

This is behind feature flags that are off by default, so
merging this patch should not cause any change in default
behaviour.

This may break some extensions (The most obvious one
is charinsert (See fe648d41005), but will probably need
some testing in report-only mode to see if anything else breaks)

This uses the unsafe-eval option of CSP, in order to
support RL's local storage thingy. For better security,
we may want to remove some of the sillier uses of eval
(e.g. jquery.ui.datepicker.js).

For more info, see spec: https://www.w3.org/TR/CSP2/
Additionally see:
https://www.mediawiki.org/wiki/Requests_for_comment/Content-Security-Policy

Bug: T135963
Change-Id: I80f6f469ba4c0b608385483457df96ccb7429ae5
2018-05-13 21:01:11 -07:00
jenkins-bot
589fa9248d Merge "Create update SPARQL for category changes" 2018-05-10 15:59:02 +00:00
jenkins-bot
486895a5b3 Merge "[MCR] Introduce RevisionSlotsUpdate." 2018-05-09 13:27:08 +00:00
jenkins-bot
cfd378774e Merge "Special:Preferences: Create flag to enable OOjs UI" 2018-05-08 21:32:01 +00:00
Kunal Mehta
853b8fe34c tidy: Remove obsolete Depurate and Balancer drivers
The Html5Depurate driver was intended to be used with an external Java
service, but it never gained traction due to deployment concerns.

The Html5Internal (Balancer) driver was originally intended for use with
the balanced templates proposal and could also handle tidying. But it was
tightly coupled to MediaWiki, so part of it was used as the basis of the
RemexHtml library. Remex most likely can also implement the balanced
templates proposal, so there isn't any reason to keep the Balancer code
around anymore,

Change-Id: I8542d69e9cdbf0e2fb7ebbb919933a64c1b8c293
2018-05-08 15:32:49 +00:00
daniel
8b0506bd8b
[MCR] Introduce RevisionSlotsUpdate.
The RevisionSlotsUpdate interface represents a change to a pages slots,
as applied by an edit.

This also introduces RevisionSlots::hasSameContent and pulls up
getTouchedSlots() and getInheritedSlots() from MutableRevisionStore
to RevisionStore, in preparation of using these classes in the
refactoring of WikiPage::doEditContent and friends.

Bug: T174038
Change-Id: Idb0ef885b343a76137b640fdfc1bf36104b00895
2018-05-08 15:58:51 +02:00
Umherirrender
fc871584ec Remove deprecated SqlDataUpdate class
Deprecated since 1.28

Change-Id: I4dcbc8fcfdb99caa0469e7cf63745b94e19cd21d
2018-05-05 11:18:47 +02:00
Ed Sanders
4633f4d46a Special:Preferences: Create flag to enable OOjs UI
This reverts commit 808e45d13d.

Bug: T117781
Change-Id: I152b82bcd647d97062eb82cd2d1064609124f9bc
2018-05-03 15:23:14 +00:00
Timo Tijhof
9bf3916322 media: Rename files to match the name of the class they define
This will make jumping from file to file much easier in text
editors when file name lookups will autocomplete naturally when
looking for a class by name.

Change-Id: I4b2e55a2e72674b619d5a592866c8a019a2b0224
2018-04-28 02:07:33 +01:00
jdlrobson
1bc62c548c Introduce ResourceLoaderLessVarFileModule
This ResourceLoader module provides a way to ship
messages to CSS variables.

We will need this going forward to deal with flash of
unstyled content in various JavaScript based UIs that
are subject to i18n such as table sorting and
collapsible elements.

To avoid overhead of hitting the database to fetch and
transform localisation messages we make use of the MessageBlobStore
making use of `messages` definition already inside
ResourceLoaderFileModule. Given this resource is only intended
for render blocking styles without JavaScript this should be okay
(although if requested in JavaScript will also ship associated
messages)

Bug: T42812
Change-Id: I2bf12cdc848478889acbe9a7a970e46f8aefa287
2018-04-25 11:27:11 -07:00
jenkins-bot
c9d8188f1e Merge "Create Expiry Widget with Date Time Selector" 2018-04-24 18:22:58 +00:00
Stanislav Malyshev
bc9e1a086e Create update SPARQL for category changes
This script creates SPARQL UPDATE statements for changes in a given time
period. These statements can be applied to an existing database to
update it.

See tests for examples of how the statements look like.

Bug: T173774
Change-Id: I9867ad566c0619b55a48a011bd3c55321b1bfcff
2018-04-20 16:40:35 -07:00
David Barratt
3481e3b2e0
Create Expiry Widget with Date Time Selector
Special:Block needs a date time selector for easier selection of expiry. To
accommodate this cleanly, a new Expiry Widget is created that handles this
logic.

Bug: T132220
Change-Id: I2853a2ca0ae6ccead3978f4bb50a77c2baa3a150
2018-04-19 20:24:08 -04:00
Timo Tijhof
e912be7387 skins: Remove MediaWikiI18N class and QuickTemplate::setTranslator
Deprecated in 1.31.

Bug: T186090
Change-Id: I2ff268868bf6f112add6fc3a5718e83467781b13
2018-04-18 00:49:24 +01:00
Kunal Mehta
c8833d8e8e Handle extension dependencies in the installer
As there will likely be extensions bundled with the 1.31 release that
depend upon other extensions, we should have the installer prevent users
from enabling extensions that depend on other, not-enabled extensions.

We can build a dependency map from extension.json's "requires"
component. On the client-side, we'll first disable all checkboxes that
require other extensions, and evaluate each checkbox click, updating the
disabled checkboxes as possible.

This required some refactoring of how ExtensionRegistry reports issues
with dependency resolution so we could get a list of what was missing.

While we're at it, sort the extensions under headings by type.

This does not support skins that have dependencies yet (T186092).

Bug: T31134
Bug: T55985
Change-Id: I5f0e3b1b540b5ef6f9b8e3fc2bbaad1c65b4b680
2018-04-13 15:28:40 -07:00
Aaron Schulz
477b835945 rdbms: allow cancelation of dangling nested atomic sections
* Make startAtomic() return a token that can be used with cancelAtomic()
  cancel any nested atomic sections that have not yet been ended.
* Make doAtomicSection() clear dangling nested sections by default.
* Also give doAtomicSection() a $cancelable parameter, having the
  same default as startAtomic().

Change-Id: I75fa234cb1dcfef17dc9a973a3b02d2607efa98e
2018-04-10 16:34:31 -07:00
Kunal Mehta
24ae4318b3 Don't use phpcs:ignoreFile to selectively ignore sniffs
Because it doesn't work. `phpcs:ignoreFile` is intended as a performance
shortcut, and gives up on the file as soon as that token is found.
Instead, use `phpcs:disable` which does support selectively disabling
some sniffs. And since disabling is local to the file, there's no need
to re-enable it at the bottom of the file.

<https://github.com/squizlabs/PHP_CodeSniffer/issues/1903> has some
relevant discussion and clarification from upstream on this.

And make the files that are now being re-enabled pass PHPCS.

Change-Id: Ia4d8c45045f61cf9f24eb1d8631ff98d99c82d69
2018-04-08 17:08:53 -07:00
Aaron Schulz
3975e04cf4 rdbms: make Database query error handling more strict
Handle all errors in query() that might have caused rollback by
putting the Database handle into an error state that can only be
resolved by cancelAtomic() or rollback(). Other queries will be
rejected until then.

This results in more immediate exceptions in some cases where
atomic section mismatch errors would have been thrown, such as a
an error bubbling up from a child atomic section. Most cases were
a try/catch block assumes that only the statement was rolled back
now result in an error and rollback.

Callers using try/catch to handle key conflicts should instead use
SELECT FOR UPDATE to find conflicts beforehand, or use IGNORE, or
the upsert()/replace() methods. The try/catch pattern is unsafe and
no longer allowed, except for some common errors known to just
rollback the statement. Even then, such statements can come from
child atomic sections, so committing would be unsafe. Luckily, in
such cases, there will be a mismatch detected on endAtomic() or a
dangling section detected in close(), resulting in rollback.

Remove caching from DatabaseMyslBase::getServerVariableSettings
in case some SET query changes the values.

Bug: T189999
Change-Id: I532bc5201681a915d0c8aa7a3b1c143b040b142e
2018-04-04 21:26:11 -07:00
jenkins-bot
1a9ba829a5 Merge "Populate ar_rev_id and make it non-nullable" 2018-04-03 15:37:05 +00:00
jenkins-bot
2c46e06676 Merge "Introduce deleteAutoPatrolLogs maintenance script" 2018-04-03 05:25:53 +00:00
Amir Sarabadani
e1a23c9aad Introduce deleteAutoPatrolLogs maintenance script
It's useful to delete old patrol logs that are not useful

Bug: T189594
Change-Id: I605bb85f172eb25df45ed83ce50a3d1044f1c281
2018-04-03 03:42:04 +02:00
Brad Jorsch
f78faf4566 Populate ar_rev_id and make it non-nullable
Revisions deleted before MediaWiki 1.5 do not have a value in this
field. This is going to be a problem for migration to the MCR schema, so
provide a maintenance script to clean this up.

Then, for good measure, change the schema to make the field
non-nullable.

Bug: T182678
Change-Id: Ie2e11f12a30f379db32c3e074658012c6f93adb0
2018-04-02 13:08:55 -04:00
James D. Forrester
fd4db7a22b Drop the ProfileSection class, deprecated in 1.25 and unused
Change-Id: I3979f193562bce8252fc8778baaf78bd0d2c1a40
2018-03-26 10:55:41 -07:00
Aaron Schulz
4f31afd21b Move most User::clearAllNotifications() logic to WatchedItemStore
Change-Id: Ib1b0c40e408f6fad6fc8257c5073fa1c3c264c3a
2018-03-23 10:26:13 +00:00
jenkins-bot
c97a962bdb Merge "Convert OutputHandler functions to a class" 2018-03-21 20:56:22 +00:00