Commit graph

781 commits

Author SHA1 Message Date
Krinkle
c04f2eb05d Merge "resourceloader: Embed 'mediawiki' directly in startup response" 2018-06-28 01:43:55 +00:00
Gergő Tisza
2f1e5a8d22 Merge "[MCR] populateContentTables maintenance script" 2018-06-27 18:57:01 +00:00
Timo Tijhof
b7b84d55d4 resourceloader: Embed 'mediawiki' directly in startup response
Embed the essential files to define mw.loader directly as part of
the startup module.

* This means the internal 'mediawiki' module no longer exists.
  This is safe to remove because:
  1) While registered server-side for loading from startup.js, a PHPUnit
     structure test disallowed being specified as a dependency.
  2) Anything that attempted to load it client-side failed because the
     module was marked in the registry as 'raw', thereby excluding it
     from the data sent to the client-side. As such, it was seen as an
     unknown module that the client refused to fetch from the server.

* Deprecate getStartupModules() and getLegacyModules().
  These are no longer needed. There are no known callers anywhere in
  Wikimedia Git or elsewhere indexed by Codesearch, but easy enough
  to leave as no-op for one release.

* Remove ResourceLoaderRawFileModule class.
  No longer needed. Was created as a hack specifically for the 'mediawiki'
  module so that it would not leak global variables in debug mode.
  It has no usage anywhere in Wikimedia Git, nor elsewhere in Codesearch.
  Remove without deprecation given this was meant to be a 'private' class.

* Introduce (private) getBaseModules(). Previously, this list only existed
  locally in getStartupModulesUrl() by merging getStartupModules() and
  getLegacyModules(). This value was factored out into its own method.

* Make getStartupModulesUrl() private and rename to getBaseModulesUrl().
  It is only used internally to export the 'baseModulesUri' value.
  Its name was already confusing before, but it would've been even more
  confusing now given it doesn't even call getStartupModules() any more.

Bug: T192623
Change-Id: I14ba282d7b65e99ca54b7c2f77ba6e1adaddd11c
2018-06-27 17:06:35 +00:00
aude
c22a2c9f75 [MCR] populateContentTables maintenance script
This introduces a maintenance script for populating the tables
introduced by the MCR storage schema, namely:

  slots
  slot_roles
  content
  content_models

Per default, both the revision and archive tables are processed.

This script is part of the MCR schema migration: after instructing
RevisionStroe to write both the old and the new schema by setting
$wgMultiContentRevisionSchemaMigrationStage = MIGRATION_WRITE_BOTH,
this script can be used to back-fill the new schema for existing
revisions.

Doing this is a precondition to later setting
$wgMultiContentRevisionSchemaMigrationStage = MIGRATION_NEW to
complete the schema migration.

Bug: T182682
Change-Id: Iecc67c1b8c082be1a1039eeb52e76ad16b965226
2018-06-25 15:40:01 +02:00
jenkins-bot
85724779ef Merge "Add maintenance to populate change_tag_def table and ct_tag_id field" 2018-06-16 12:59:28 +00:00
Amir Sarabadani
f1e450564f Add maintenance to populate change_tag_def table and ct_tag_id field
Bug: T193871
Change-Id: I5e863ffcfad5f2b66fb8d50666494acae3480d1a
2018-06-15 17:57:27 +02:00
Erik Bernhardson
2a43939ffb Push pagination decision for search into SearchEngine
Various code using the search engine shouldn't need to implement it's
own methods, such as over-fetching, to determine if there are more
results available. This should be knowledge internal to search that is
exposed by a boolean.

Change-Id: Ica094428700637dfdedb723b03f6aeadfe12b9f4
2018-06-11 13:35:44 -07:00
jenkins-bot
693c3ad67b Merge "installer: Fix display of UPGRADE by disabling InterwikiLookup" 2018-06-07 16:49:40 +00:00
jenkins-bot
6bfa7c3754 Merge "Introduce per-schema unit tests for revision storage." 2018-06-07 13:47:00 +00:00
daniel
32e9266d8d Introduce per-schema unit tests for revision storage.
This introduces traits for testing different schema variations.
These are not very useful in this patch, but make it much easier
to add tests for MCR schema migration in subsequent patches.

The code in this patch was previously part of If259b1e1c49ceaa4.

Change-Id: I239572f75bebbc9c731a3e3860c4eff179dc15e4
2018-06-07 13:31:16 +00:00
Kunal Mehta
a498abf272 installer: Fix display of UPGRADE by disabling InterwikiLookup
Since 129067c907, parsing section titles has looked up interwiki
prefixes with InterwikiLookup. In the web upgrader, this triggers
database access, and since that service is disabled, it throws
exceptions, causing parsing to fail.

Work around that by using a dummy InterwikiLookup service that knows
about no interwiki prefixes. Maybe one could be written to just read
from the stock `interwiki.list`, but that's a project for another time.

Bug: T196607
Change-Id: I13485a9af79297b552a1128240cb8597c2ef83d8
2018-06-07 01:01:13 -07:00
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