Commit graph

5315 commits

Author SHA1 Message Date
Gergő Tisza
ec72a9f495
SlotDiffRenderer: add utility method for parameter type checks
Change-Id: I0161070fd0330d4945cec2f76f4fd8128a9793b9
2018-09-24 23:09:18 -07:00
jenkins-bot
1ea48f3e29 Merge "resourceloader: Add filter cache version to module version hash" 2018-09-24 17:38:09 +00:00
jenkins-bot
1298becf10 Merge "resourceloader: Remove MW cacheEpoch from module version hash" 2018-09-24 17:35:22 +00:00
jenkins-bot
0245bce017 Merge "Code to read from change_tag_def table instead of valid_tag" 2018-09-24 17:19:48 +00:00
Roan Kattouw
1ed0a109ec resourceloader: Add filter cache version to module version hash
We already had a $filterCacheVersion variable, but it was
only used for the internal cache for JS and CSS minification,
which is not enough. If there is a breaking change in either
of these processes, we also need to invalidate version hashes.

This commit renames ResourceLoader::$filterCacheVersion to
ResourceLoader::CACHE_VERSION and takes it into account in
getVersionHash(). Adding it to getDefinitionSummary() is not
sufficient, because content-hashed modules also need to be
invalidated when there's a breaking change in the minifiers.

This cache version can also be incremented when there's a
breaking change in image embedding or LESS compilation,
although content hashing deals with that already, so we
could also add a separate cache version for those that's
only added to getDefinitionSummary().

Bug: T176884
Change-Id: Ife6efa71f310c90b9951afa02212b2cb6766e76d
2018-09-24 17:10:48 +00:00
Timo Tijhof
450da07f3a resourceloader: Remove MW cacheEpoch from module version hash
This seems quite nuclear. I'd actually like to deprecate the
wgCacheEpoch variable more generally in favour of a handful
of more specific version constants, but as starting point,
remove it from the hash used for load.php urls and localStorage
keys.

The latter is also controlled by wgResourceLoaderStorageVersion
already.

Also ref T32956 about a more standalone ResourceLoader.

Change-Id: I913f846090e82d3d822653b9b7ce22233cdb5e90
2018-09-24 17:10:35 +00:00
jenkins-bot
0eb72aca60 Merge "SpecialLog: Don't throw exceptions on invalid date from user input" 2018-09-24 16:17:07 +00:00
Kunal Mehta
f198154d76 SpecialLog: Don't throw exceptions on invalid date from user input
If users provide invalid input to the date option on Special:Log (most likely
an intentional thing given the calendar input widget), don't let the
TimestampException bubble up - just discard the invalid date.

Integration test included, which fails without this patch.

Bug: T201411
Change-Id: Ie1a9a84343ae4e78e076586f759917e5fd5af33c
2018-09-24 08:56:48 -07:00
jenkins-bot
74d04edec3 Merge "RevisionStoreDbTestBase, remove redundant needsDB override" 2018-09-24 13:48:21 +00:00
jenkins-bot
0c045de899 Merge "registration: Let extensions add PHP version requirements" 2018-09-24 05:43:18 +00:00
MGChecker
8af76decf8 registration: Let extensions add PHP version requirements
While MediaWiki Core already sets requirements for PHP versions, it should be
possible for extensions to tighten these requirements. This mirrors the PHP
parameter of extension infoboxes as well.

This change introduces a new 'platform' key (in addition to 'MediaWiki', 'skins'
and 'extensions', where non-MediaWiki software requirements will be listed
in the future, starting with a PHP version constraint. Further keys are
supposed to be added to allow setting constraints against php extensions
and other abilities of the platform.

Bug: T197535
Change-Id: I6744cc0be2363b603331af9dc860eb8603a1a89a
2018-09-22 03:43:28 +02:00
jenkins-bot
fbc4c39708 Merge "Remove global namespaced LBFactory" 2018-09-21 23:40:45 +00:00
jenkins-bot
62c36e82cf Merge "CommentStore: Hard-deprecate newKey()" 2018-09-21 18:42:23 +00:00
Reedy
71badb429e Remove global namespaced LBFactory
Change-Id: Ia87aa5c9426af83627a1bbc9bd914546c89c1e47
2018-09-21 15:42:42 +00:00
Reedy
1c5399b471 tests: Stop using deprecated LBFactory, use namespaced version
Change-Id: Ifbbbfe1bc58e57739b88588e3b6feb703f20534d
2018-09-21 02:37:12 +00:00
James D. Forrester
733704ed82 CommentStore: Hard-deprecate newKey()
Not used by any extensions known to Wikimedia git.

Change-Id: I3c07ad6db9d88feddad1cf29d4794fef622298ea
2018-09-20 10:15:39 -07:00
C. Scott Ananian
6f8431c4f5 Hard-deprecate the $wgUseTidy option
This has been soft-deprecated since MW 1.26; this hard-deprecation
sets the stage for future removal of this old cruft.

Bug: T198214
Depends-On: Idf246d05d116f63a73105b50a1929a7721fbe7b9
Change-Id: I2e7d990da1da378eb6e828d4b3c0f5a41791dd92
2018-09-20 11:08:40 -04:00
jenkins-bot
141d921ceb Merge "resourceloader: Add internal RLPAGEMODULES constant" 2018-09-19 18:40:36 +00:00
jenkins-bot
7ff140becb Merge "resourceloader: Make ResourceLoader::makeLoaderRegisterScript() internal" 2018-09-19 18:33:34 +00:00
daniel
d6b989b550 Use "Unknown user" instead of an empty user name.
This changes the user name to "User unknown" when constructing a RevisionRecord
from a database row that has an empty ar_user_text resp rev_user_text field.

This may cause "User unknown" to be written to the database, if the
RevisionRecord is used as the basis for a new revision that is being created,
particularly during undeletion. Since "Unknown user" is listed in
$wgReservedUsernames, this should never lead to conflicts with actual user
names.

It is assumed that empty ar_user_text and rev_user_text fields will be 
fixed during migration to the new actor based database schema.

Bug: T195692
Change-Id: I506c513b019778d83741e47f0d11093f5ab67a54
2018-09-18 10:53:00 -07:00
Timo Tijhof
f22b3b81f9 resourceloader: Add internal RLPAGEMODULES constant
Expose this constant for internal use by Navigation Timing,
so that it can compute mwLoadEnd based on when these modules
finish loading.

The way mwLoadEnd is currently computed is by building a list
of all registered module names, and narrowing it down to the
ones in 'loading' state at the time that ext.navigationTiming.js
executes. The problem with doing that, is that it is includes
various lazy-loaded modules that aren't critical to the page and
aren't meant to be tracked by that metric. For example:

* Preloading of modules from various extensions (including VE,
  and Popups).
* Background chains for EventLogging schemas from mw.loader.using,
  including the one started by Navigation Timing itself.
  On my local install, the list of filtered down modules always
  includes 'schema.SaveTiming', '...rumSpeedIndex', etc.

Exporting the list passed to the initial load() call as constant
will enable Navigation Timing to instead only await only those
modules (and their dependneices).

Bug: T204426
Change-Id: Ida134b4dfee218db16c2d1f88d4f26e8d761e154
2018-09-18 01:10:01 +01:00
Timo Tijhof
0a5757cda8 resourceloader: Make ResourceLoader::makeLoaderRegisterScript() internal
* There is only a single non-test caller to this method in the entire
  codebase, and no callers elsewhere (Wikimedia Git, Codesearch).

  It's only used with an array, so remove the other unused code paths,
  and mark it internal (to my knowledge, nothing ever used it outside
  RL in the past, either).

* Add test coverage for the module indexing logic.

Change-Id: I9e0f95416d5b2fdd87323288231ee6d8c85d88e7
2018-09-18 00:53:42 +01:00
jenkins-bot
b7625d63a6 Merge "Introduce ContentHandler::getSecondaryDataUpdates." 2018-09-17 14:06:19 +00:00
jenkins-bot
0e56ff447b Merge "Give more specific error messages on Special:Redirect" 2018-09-16 19:40:32 +00:00
Umherirrender
114e6547de Give more specific error messages on Special:Redirect
Added some basic tests

Bug: T202183
Change-Id: Ib0dd50ff5575a2b2093a57afce79e9f8623fa24d
2018-09-16 18:17:54 +00:00
jenkins-bot
9801a1245c Merge "build: Updating mediawiki/mediawiki-codesniffer to 22.0.0" 2018-09-16 16:13:55 +00:00
Umherirrender
a4caa4d0c6 build: Updating mediawiki/mediawiki-codesniffer to 22.0.0
Added spaces around .
Removed empty return statement which are not required
Removed return after phpunit markTestIncomplete,
which is throwing to exit the test, no need for a return

Change-Id: I2c80b965ee52ba09949e70ea9e7adfc58a1d89ce
2018-09-16 15:51:11 +00:00
Umherirrender
4da52463e3 Ensure database is setup in MediaWikiTestCase::insertPage
Also in editPage
Add missing @group Database

Depends-On: Id81425fff0a41c651c1967698124246befcdb032
Depends-On: If97d9e6e525465ca3879003e71dd5e67fc0afdfd
Change-Id: I3bfd478769e0907913834c9639af4375223638cc
2018-09-14 22:32:23 +02:00
daniel
7960d5385f Introduce ContentHandler::getSecondaryDataUpdates.
This adds getSecondaryDataUpdates and getDeletionUpdates
to ContentHandler, and updates WikiPage and DerivedPageDataUpdates
to handle DataUpdates from all slots.

Bug: T194038
Bug: T194037
Change-Id: I75c96318f58a5cdda48484f7040ae41e6f42392a
2018-09-14 16:18:18 +02:00
Amir Sarabadani
c4d2ac4d14 Code to read from change_tag_def table instead of valid_tag
This table will be dropped once the migration is completed

Bug: T194162
Change-Id: I2575b22fcdf4812dd62055f7cf157255c37a2c1f
2018-09-14 13:50:59 +02:00
James D. Forrester
b5ce7632c7 hooks: Drop Special{Watchlist|RecentChanges}Filters, deprecated in 1.23
Neither SpecialWatchlistFilters nor SpecialRecentChangesFilters are used in any
code known to Wikimedia code search. The related code to use these hooks was
only ever used within the MediaWiki repo.

Change-Id: Ib631d49d7b5835c665171dbad3e8a646b80827ef
2018-09-12 12:43:01 -07:00
jenkins-bot
9d00d8783e Merge "Go search to consider fragment only title invalid" 2018-09-12 05:18:09 +00:00
jenkins-bot
ec144bdf18 Merge "test: disable hook when testing default preferences" 2018-09-11 20:50:06 +00:00
Erik Bernhardson
b357416273 Go search to consider fragment only title invalid
When submiting using the 'go' feature of Special:Search (standard
usecase for autocomplete) a nearby title can be selected.
Unfortunately a fragment only title is considered valid, which
sends the user to Main_Page#searchterm.

Instead don't allow a search starting with # to trigger the go
feature.

Bug: T182452
Change-Id: I8ce3ce8633e23db41ae6eafb9996ca7294f8445a
2018-09-11 13:03:53 -07:00
daniel
4835a75ec5 Use RevisionRenderer for rendering ParserOutput
Bug: T174035
Bug: T174036
Change-Id: I1085b05d635dd954c143c8a398fae909632ba0a9
2018-09-11 15:25:39 +00:00
daniel
c391e4870c Cover incomplete revision case in RenderedRevision.
This introduces a check that allows magic words like {{REVISIONUSER}}
to still work even when an incomplete fake RevisonRecord is provided to
RevisionRenderer. In such a case, the revision is loaded from the database
if needed. This lets old code that only has access to a Content object for
rendering use that Content object in a fake RevisionRecord, instead of
having to load the full revision from the database in all cases.

Bug: T174035
Change-Id: I658eab97a8282b8943baf7968f3256da35789ec1
2018-09-11 15:25:11 +00:00
jenkins-bot
05b2874f37 Merge "Introduce RevisionRecord::isReadForInsertion" 2018-09-11 15:14:17 +00:00
jenkins-bot
388524219c Merge "[MCR] Set MCR migration stage to write-both/read-new." 2018-09-11 13:59:46 +00:00
daniel
bc42269dba Introduce RevisionRecord::isReadForInsertion
RevisionRecord::isReadForInsertion provides a concise way to check
whether a revision is complete enough to be inserted into the database.

Change-Id: I0c79f55c0b935bce9943163ed4c2cc8b5f9c82d5
2018-09-11 10:54:57 +00:00
daniel
9bd162dce2 [MCR] Set MCR migration stage to write-both/read-new.
This patch exists to see if CI passes with
$wgMultiContentRevisionSchemaMigrationStage set to
SCHEMA_COMPAT_WRITE_BOTH | SCHEMA_COMPAT_READ_NEW.

NOTE: verify that $wgMultiContentRevisionSchemaMigrationStage
is explicitly set toSCHEMA_COMPAT_WRITE_BOTH | SCHEMA_COMPAT_READ_OLD
in production config (T197816) before merging this.

Bug: T198561
Depends-On: Ib718868d2c768b6ea851355eef047bc0e6593495
Change-Id: I15989adae2b5916577d164c50d7da88774e49324
2018-09-11 12:27:42 +02:00
jenkins-bot
98f987241a Merge "resourceloader: Remove closure around $CODE.defineLoader()" 2018-09-11 09:30:52 +00:00
jenkins-bot
c02af5f13f Merge "resourceloader: Remove support for addSource(id, url)" 2018-09-11 09:06:31 +00:00
daniel
f5b7a93979 Fix undeletion write-both/read-old mode.
With the new schema, undeletion does not create now slot rows.
However, when in read-old mode, we may still have un-migrated
archive rows. When undeletion based on such a row, we do need
to insert a slot row.

This also changes the return value of SlotRecord for
SCHEMA_COMPAT_READ_OLD mode from null to the negative value of
rev_text_id, for consistency. Conceptually, the emulated slots
in SCHEMA_COMPAT_OLD now have a "virtual" content ID, hich is
 however distinct from any real content ID that may exist in
the future. Such virtual content IDs are however not assigned
in SCHEMA_COMPAT_WRITE_BOTH mode. In that mode, unmigrated
rows can be detected by calling hasContentId() on the main
slot. Migrated rows will return true here and provide the
id of the associated content row, even in
SCHEMA_COMPAT_READ_OLD mode. This is particularly essential
for undeletion, which needs to maintain the association
between revision and slot rows even in SCHEMA_COMPAT_READ_OLD
mode.

Bug: T174024
Bug: T194015
Bug: T183488
Change-Id: I88ee9809b9752e1e72d635d62e82008315402901
2018-09-10 19:36:27 +00:00
Brad Jorsch
87dd9db226 Update wikimedia/timestamp to v2.1.1
Also enable some tests for PostgreSQL that are fixed by the new version.

Bug: T195807
Change-Id: Id0d016f620662836b3a17de5f118715c1cbe3e69
Depends-On: I3bd8df5236600963be89602b2a52d0d95d640d66
2018-09-10 15:31:26 -04:00
daniel
452c71663b Consolidate tests for getQueryInfo() and related methods.
This consolidates tests for getQueryInfo, getArchiveQueryInfo,
getSlotQueryInfo, and similar methods that help application logic
be compatible with different migration stages of different aspects
of the revision storage schema.

Bug: T198561
Change-Id: I8e4ae69d7e00721a0af125afaf9a708f7fe99b0a
2018-09-10 18:16:46 +00:00
Antoine Musso
eb8e2ba234 test: disable hook when testing default preferences
The GetPreferences hook lets extensions register additional user
preferences.  They show up on the form and that breaks the hardcoded
assertion that exactly 5 preferences are available.

Disable the hook in case the test is run with extensions loaded in (ex:
BetaFeatures).

Change-Id: I78b11e989110407cd721e8a3fbbe81d28ca4be5b
2018-09-10 10:25:22 +02:00
Timo Tijhof
4b069cdc1e resourceloader: Remove closure around $CODE.defineLoader()
Follows-up b7b84d55d4, which embedded the whole of the three 'mediawiki'
JS files inside of startup.js, but did so inside of the pre-existing
closure that was there.

This adds some overhead we don't get value of, so best to remove
it and embed it as a sibling of startup.js in the same top-level
scope.

In local testing (Chrome stable, CPU 1/6th) this reduced startup
run-time from 73-78ms to 63-65ms.

Also:
* Declare isCompatible() as a normal function.
  Disable the implicit-globals warning given this isn't a regular module,
  this file is  intentionally in the global scope.
* Unfold the private startUp() function to its call site.

Change-Id: Ida51ab20898c9e4ae6cbf7ad2968d88d824a1483
2018-09-08 22:45:03 +01:00
Timo Tijhof
f3641c0a9c resourceloader: Remove support for addSource(id, url)
The PHP interface still supports it without deprecation, but there
is no need for the client to support it given it is only ever called
from the startup module, which always passes it an object.

Follows-up 6815e35575, which did the same for `state(key, val)`.

Also simplify the implementation to avoid extra calls and optimise
for the only signature.

Mark the method as @private, and change the existing use of
@protected to @private (doesn't really make sense in JavaScript).

Change-Id: I24786f90bcfb256b2e7c37f7760bba1a5e399443
2018-09-08 22:45:03 +01:00
Gergő Tisza
1bb5b58eb1
Unwrap HTML loaded from parser cache
Partially and temporarily reverts I1641b7995 to deal with cached
HTML the same way the old code did.

Bug: T203716
Change-Id: I29846a6513f6b580b429c0bfe6c310ada50b28bb
2018-09-07 18:49:34 +02:00
jenkins-bot
e93fdaca02 Merge "Linker: more consistent whitespace parsing in formatLinksInComment" 2018-09-06 19:41:59 +00:00