Commit graph

5561 commits

Author SHA1 Message Date
Aryeh Gregor
c057200613 Minor cleanup in ApiBlockTest
Use tablesUsed instead of cleaning up ourselves.

Change-Id: Ibe470a8f292d65ceeaa098d5c033b8585501a9f3
2018-10-04 15:55:55 +03:00
daniel
414215ccac ParserOutput::getCacheTime should stay the same after the first call.
Previously, getCacheTime would default to the current time, potentially
causing the return value to change over subsequent calls. With this change,
the value is determined on the first call, and then remembered for subsequent
calls.

Bug: T205464
Change-Id: If240161c71d523ad5b0d33b9378950e0bebceb6e
2018-10-04 13:08:56 +02:00
Timo Tijhof
1d0e26cf83 UIDGenerator: Misc clean up
Various miscellaneous clean ups with no change to any of the
logical code. This to make the next commit have a cleaner diff
for easier review.

* Make internal millitime() non-static.

* Improve documentation and add missing @covers annotations.

* Correct getTimestampedID88() documentation to state that
  only two values need to be passed, not three.
  This is significant because the Flow extension is actually
  using this method in a subclass and passes only two values.

Bug: T94522
Change-Id: I2a0c51bea58df4cc0c253c1c10de3ac383f04c8e
2018-10-04 12:44:17 +02:00
Fomafix
1472f02b36 Phabricator: Use Tddddd instead of Bug ddddd in comments
Change-Id: Ic9fe03cab270bd6be738af346164ad5d31a0d780
2018-10-04 09:15:02 +02:00
jenkins-bot
9eb3834b89 Merge "Drop 'SpecialRecentChangesQuery' & 'SpecialWatchlistQuery' hooks, deprecated in 1.23" 2018-10-03 23:32:36 +00:00
jenkins-bot
6866617c2c Merge "Database: close() should not commit transactions" 2018-10-03 23:25:22 +00:00
Kosta Harlan
0a7c0a6797 Move test assertion to mirror parameter order
Follow up from I2df0551c5837adc578b27082ab6ba2ac95d937f8

Bug: T206130
Change-Id: Ib669c77fdb709846d0182cb28796cf53914114c4
2018-10-03 16:42:55 -04:00
jenkins-bot
12d9221ede Merge "SECURITY: Fix permissions check for patrol action" 2018-10-03 19:50:32 +00:00
Kosta Harlan
890ffc619d SECURITY: Fix permissions check for patrol action
Return existing errors instead of empty array in checkUserConfigPermissions().
Returning an empty array wiped out previously-found errors.

Also add test coverage for patrol action.

Bug: T206130
Change-Id: I2df0551c5837adc578b27082ab6ba2ac95d937f8
2018-10-03 12:07:46 -07:00
Brad Jorsch
bf30fcb714 Database: close() should not commit transactions
Transactional databases normally roll back when a connection is closed
with an open transaction rather than committing them, so MediaWiki
committing them is unexpected.

There are two cases being changed here: automatic transactions without
writes and manual transactions. For the former it shouldn't make a
difference if we commit or roll back since no writes were done anyway.
The latter has logged a message since MW 1.31 (I0992f9a8), and that
warning has not been logged in Wikimedia production in the past 60 days
so we should be ok there too.

Bug: T206147
Change-Id: Ieceef4deb49044db8f0622d38ee76c9d9f39704c
2018-10-03 14:55:43 -04:00
Aryeh Gregor
2bb3551082 Only use "*Test.php" for actual PHPUnit tests
Otherwise I get errors every time I try to run PHPUnit on includes/ or
includes/parser, because it tries to run ParserIntegrationTest.php and
fails.  Apparently the <exclude> in suite.xml doesn't work if PHPUnit is
invoked on a directory.

Bug: T201278
Change-Id: I7d09576bee2705d8516152e8fa671da8dac40233
2018-10-03 20:22:22 +03:00
Aryeh Gregor
589741b541 Re-enable tests from TitlePermissionTest
Let's see if they work now that services are reset between tests.

This reverts commit 7f843b0c04.

Bug: T201776
Change-Id: Iea7c74f8c77a97d83385b4399e500cf8129a1158
2018-10-03 15:38:45 +03:00
jenkins-bot
b3a4973cf8 Merge "Migrate image descriptions from image_comment_temp" 2018-10-03 01:23:54 +00:00
Aaron Schulz
7d2b121ac8 MessageCache: remove confusing and unused $isFullKey parameter from get()
Follows-up cba0fb1c15, which removed the last caller.

Change-Id: I00c17fedff39b1b35519cff2a0f8eac3e4d6f2ab
2018-10-02 23:34:53 +00:00
jenkins-bot
99dcd46f00 Merge "rdbms: make * consistently act like in select/insertSelect methods" 2018-10-02 16:44:54 +00:00
jenkins-bot
4e82bcaf9f Merge "Add audience parameter to PoolWorkArticleView" 2018-10-02 15:12:05 +00:00
Brad Jorsch
7a422138a7 Migrate image descriptions from image_comment_temp
image_comment_temp was always intended to be temporary, until an
expensive schema change on Wikimedia Commons's image table could be
done. Now that that has been done, stop writing image_comment_temp and
add a migration script to copy existing data into img_description_id.

Ic8efeddc will remove the reads from image_comment_temp and drop the
image_comment_temp table.

Bug: T188132
Change-Id: Iab5f521577a415b2dc213b517ee8a0dca4fdd0aa
2018-10-02 10:30:00 -04:00
Gergő Tisza
5174fa8364
Add audience parameter to PoolWorkArticleView
The old behavior was that the audience was RAW if the revision object
parameter got passed in, otherwise PUBLIC. This was undocumented and
not used outside core; this patch gets rid of it in favor of an
explicit argument.

Bug: T205578
Change-Id: Ic7cdb38f658f6d85c48ff13c7f84c64a45c9b1ee
2018-10-02 03:53:28 -07:00
James D. Forrester
144b643537 Drop 'SpecialRecentChangesQuery' & 'SpecialWatchlistQuery' hooks, deprecated in 1.23
Depends-On: I9822bb2bc1bcc13eec7924208bf3819d3512ad26
Change-Id: I67c06bb99d9c9582a638f061f523661c821bca8d
2018-10-01 18:15:38 -07:00
jenkins-bot
eee5e41280 Merge "ApiOptions: fix resetting some preferences to default" 2018-10-02 01:06:20 +00:00
jenkins-bot
d3ed3b8409 Merge "Remove temporary rcfilters variables" 2018-10-01 23:09:28 +00:00
Max Semenik
3ea7bba4d4 ApiOptions: fix resetting some preferences to default
For preferences like 'skin' that have a limited number of values, null
is not a valid value, thus attempts to reset them fail with
"Validation error for \"skin\": This value is required."

Bug: T65080

Change-Id: I86554a6d30c8ab970740d8682fb2261476de0677
2018-10-01 15:48:19 -07:00
Aaron Schulz
46cf714ce7 rdbms: make * consistently act like in select/insertSelect methods
This now matches the documentation of insertSelect()

Bug: T202553
Change-Id: Ie6602fdd3b48b9136de7c65289c85ced5f5f2f1d
2018-10-01 14:31:53 -07:00
jenkins-bot
67dc908246 Merge "Preserve whitespace in search index text content" 2018-10-01 18:22:48 +00:00
MGChecker
c7e45b6211 registration: Let extensions add PHP extension requirements
This change adds the possibility to specify ext-* keys under the 'platform'
key introduced in I6744cc0be2 to require given PHP extensions. Note that
it's impossible to add constraints different from '*', as there is no universal
way to retrieve PHP extension versions.

Bug: T197535
Change-Id: I510de1e6d80f5c1d92dc1d1665aaa6c25bf28bf7
2018-09-30 19:55:57 +02:00
Umherirrender
6fc9cf4f64 Fix caller name in DatabasePostgresTest
Seeing {closure} in the logs as caller is not helpful
Also add some missing caller name, which avoids Database::query as
caller in the logs
Change-Id: I3cab186cd63b295d1e4d1ca5232bc81925a85eb0
2018-09-30 17:38:22 +00:00
Kunal Mehta
68015d3b91 BitmapMetadataHandlerTest: Don't reinvent $this->checkPHPExtension()
Change-Id: I4957ca1be698844bafbf8de64af450cb884ec71a
2018-09-27 22:01:28 -07:00
C. Scott Ananian
91c81397cc Ensure OutputPageTest works when Translate extension is loaded
The translate extension registers the LanguageLinks hook which is run by
OutputPage::addParserOutputMetadata with a Title as an argument.  If
our mock doesn't provide a valid Title, then
PageTranslationHooks::addLanguageLinks() in Translate will throw a
TypeError in OutputPageTest::testParserOutputCategoryLinks().

Change-Id: I495c51731670f841e5ab752a3a1e014c86ef643d
2018-09-28 01:05:46 +00:00
C. Scott Ananian
f6081797f3 Add basic test cases for OutputPage::addWikiMsg / wrapWikiMsg
Change-Id: I621c22f2819b426ce6088ff3bdf1dadca274d1f9
2018-09-27 13:41:55 -04:00
Stephane Bisson
2e8512c7d0 Remove temporary rcfilters variables
wgStructuredChangeFiltersShowPreference, wgStructuredChangeFiltersShowWatchlistPreference,
and wgStructuredChangeFiltersOnWatchlist were introduced for progressive rollout
of the RCFilters app on RC and WL.

These variables and their related conditional code is no longer needed.

Bug: T196033
Change-Id: Id3799fefd21cd9bea0e089a5e12576ee9ea1085e
2018-09-27 13:39:05 -04:00
jenkins-bot
50f6b24ee6 Merge "Parser: Refactor parsing of [[File:...|link=...]] syntax for reusability" 2018-09-26 19:18:34 +00:00
jenkins-bot
2d75c56c17 Merge "Add constant for the name of the 'main' slot for MCR" 2018-09-26 11:55:10 +00:00
Bartosz Dziewoński
1c9664d18a Parser: Refactor parsing of [[File:...|link=...]] syntax for reusability
Change-Id: I91467297de4b7c532448a4c20b9a0dc8216c7200
2018-09-26 13:36:32 +02:00
jenkins-bot
361f73a912 Merge "Don't wrap output added by OutputPage::addWikiText*()" 2018-09-26 10:50:27 +00:00
jenkins-bot
0cc987680f Merge "OutputPageTest should be independent of $wgResourceLoaderDebug setting" 2018-09-25 19:36:07 +00:00
C. Scott Ananian
300b91a1ec Don't wrap output added by OutputPage::addWikiText*()
There are three methods affected: `OutputPage::addWikiTextTidy()`,
`OutputPage::addWikiTextTitleTidy()`, and
`OutputPage::addWikiTextWithTitle()`.

There's a special case in Parser.php which adds the wrapper class from
ParserOptions to the ParserOutput only if "interface mode" is off; the
affected methods default to adding output in "content language" mode
(not "interface language" mode), but they seem to be used for
"interface messages in the content language" (rare) and so should also
be unwrapped.  This would make all the `OutputPage::addWikiText*()`
methods consistent.

The `OutputPage::addWikiTextTidy()` method is only used once in the WMF
repositories, where it is used to insert an interface message in the
content language:

91cd2a928f/SpecialProofreadPages.php (40)

The `OutputPage::addWikiTextWithTitle()` method is used by no one:

https://codesearch.wmflabs.org/search/?q=addWikiTextWithTitle%5C(

The `OutputPage::addWikiTextTitleTidy()` method is used only in core:

3888c001a1/includes/EditPage.php (2669)

It seems clear that the output in this case is intended to be
unwrapped as well (the codepath adds its own explicit wrapper).

Ia58910164baaca608cea3b24333b7d13ed773339 will add additional
documentation to clarify the distinction between the different
OutputPage::addWikiText*() methods, but I felt it safer to make
this particular change first as a standalone patch, just in case
it had unexpected side effects or merited further discussion.

Change-Id: I3e5b598d358819191562b56d40ebf1cb6f3cda41
2018-09-25 14:43:20 -04:00
C. Scott Ananian
2cb60f4204 Use Remex for TextContentTest subclasses
We are deprecating untidy configurations of the parser.

Bug: T198214
Change-Id: I16529879a3b3aed960c5dc006e2af513d7e91fcd
2018-09-25 18:42:56 +00:00
jenkins-bot
3aad4bcdab Merge "Ensure disabled deprecation warnings are re-enabled before next test" 2018-09-25 17:13:14 +00:00
C. Scott Ananian
36f14abd26 OutputPageTest should be independent of $wgResourceLoaderDebug setting
`OutputPageTest::testMakeResourceLoaderLink()` and
`OutputPageTest::testBuildExemptModules()` tried to force
`$wgResourceLoaderDebug=false` before running the test, but they
neglected to clear the resource loader debug cache
(`ResourceLoader::clearCache()`) so the user's local setting of
`$wgResourceLoaderDebug` would be used despite it all.

Change-Id: I3e7dec762c8a02683fc66a630c950b72a4840a9b
2018-09-25 12:56:40 -04:00
jenkins-bot
9b1d351323 Merge "Deprecate the 'disabletidy' parameter for ApiParse" 2018-09-25 16:50:36 +00:00
C. Scott Ananian
8025629395 Ensure disabled deprecation warnings are re-enabled before next test
Tests should not interfere with each other; disabled deprecation
warnings should be disabled for a single test case only.

Bug: T191960
Change-Id: Ic9b892bc83ba6d71c1077df0d93c95dde36988bb
2018-09-25 16:30:38 +00:00
C. Scott Ananian
775bcac172 OutputPageTest: Don't rely on side effects of previous tests
Use the proper `MediaWikiTextCase::hideDeprecated()` method.

Bug: T191960
Change-Id: I974618a0bd1e11434d167820d119dcfd6e47b092
2018-09-25 10:22:52 -04:00
Gergő Tisza
ec72a9f495
SlotDiffRenderer: add utility method for parameter type checks
Change-Id: I0161070fd0330d4945cec2f76f4fd8128a9793b9
2018-09-24 23:09:18 -07:00
Gergő Tisza
6e8d39c6e7
Add constant for the name of the 'main' slot for MCR
Bug: T202142
Change-Id: I97a74e5a029b014f3c2195188936d5c8233c1b7f
2018-09-24 16:52:12 -07:00
C. Scott Ananian
eb351597e4 Deprecate the 'disabletidy' parameter for ApiParse
This will be unsupported by future wikitext parsers, which always
construct well-formed HTML.

Bug: T198214
Change-Id: Ic189cd1b38bca5b9ec0ef9810555fe0cbd8b733d
2018-09-24 17:40:51 -04:00
C. Scott Ananian
eb40f111d6 Suppress deprecation warnings for b/c use of UsageException::getMessageArray()
Follow up to efaaa2c1d6 (which was a
follow up to Iae0e2ce3).

These are exposed when T191960 is fixed.

Change-Id: I7c517b5a7cccfe9c324d0a9eeb7d774aa1be8adb
2018-09-24 17:18:00 -04: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
Erik Bernhardson
0d779c1ac6 Preserve whitespace in search index text content
Certain html tags imply a word break, but our html stripping doesn't
understand that at all. Adjust the html stripping to inject whitespace
for all block level tags (per MDN) along with the <br> element.

Bug: T195389
Change-Id: I9fbfac765ea88628e4f9b2794fb54e1cd0060203
2018-09-14 11:10:35 -07: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
jenkins-bot
e215267f65 Merge "Update API tests to comply with the new backend for change tags" 2018-09-06 19:25:44 +00:00
jenkins-bot
8fd557bd15 Merge "Provide new, unsaved revision to PST to fix magic words." 2018-09-06 17:57:12 +00:00
Thiemo Kreuz (WMDE)
2c58fbaa29 Linker: more consistent whitespace parsing in formatLinksInComment
Try to paste and preview this in the wikitext as well as the summary
line: [[:a]] [[ :a]]

The wikitext will show "a a", but the summary line will show "a :a".
This is only a display issue, all 4 links correctly link to the
article [[A]].

Change-Id: I08253a6d0b55b9aa3eace519bbdc1a456400bf84
2018-09-06 17:19:32 +00:00
daniel
465954aa23 Provide new, unsaved revision to PST to fix magic words.
This injects the new, unsaved RevisionRecord object into the Parser used
for Pre-Save Transform, and sets the user and timestamp on that revision,
to allow {{subst:REVISIONUSER}} and {{subst:REVISIONTIMESTAMP}} to function.

Bug: T203583
Change-Id: I31a97d0168ac22346b2dad6b88bf7f6f8a0dd9d0
2018-09-06 18:33:44 +02:00
jenkins-bot
52a4ffbf42 Merge "ApiComparePages: Clean up handling of slot deletion" 2018-09-05 15:53:57 +00:00
jenkins-bot
d8e5553237 Merge "[MCR] Move getSecondaryDataUpdates to the page level" 2018-09-05 12:40:40 +00:00
jenkins-bot
5eff0d6021 Merge "SpecialPageExecutor: Use finally now that we're in a PHP 5.5+ world" 2018-09-05 05:15:34 +00:00
jenkins-bot
2901b84c49 Merge "TemplateParser: Pass FLAG_MUSTACHELOOKUP to enable parent context access" 2018-09-05 00:33:42 +00:00
Gergő Tisza
51602a436c
[MCR] Move getSecondaryDataUpdates to the page level
Replaces Content::getSecondaryDataUpdates with
WikiPage::getSecondaryDataUpdates so that aggregation of
data updates from multiple page slots can be handled without
the caller having to care about it.
Also adds a WikiPage::updateParserCache method for convenience.

This is a temporary measure until DerivedPageDataUpdater
(or its replacement) can be exposed directly, at which point
the WikiPage methods will be deprecated.

Also fixes a parameter handling bug in DerivedPageDataUpdater.

Bug: T194043
Change-Id: Idbe7d582b49fcb7c90aea813773b7610ad44b1a8
2018-09-04 21:50:58 +02:00
Amir Sarabadani
d3074848e1 Update API tests to comply with the new backend for change tags
Bug: T194162
Change-Id: I35f6e36f988a9483dcb624c39e3f0cc969724fdf
2018-09-04 21:50:46 +02:00
Roan Kattouw
3c06d76521 TemplateParser: Pass FLAG_MUSTACHELOOKUP to enable parent context access
This allows variables defined in an outer context to be used in inner
contexts. For example:

<h2>{{foo}}</h2>
<ul>
{{#things}}
    <!-- bar is a property of each thing, foo is an outer variable -->
    <li>{{foo}} is a {{bar}}</li>
{{/things}}
</ul>

Bug: T203209
Change-Id: Ib0ae0fb0b4be6b161f548c79db6fb6f4b831f7c1
2018-09-04 12:39:34 -07:00
jenkins-bot
b9fd6b1327 Merge "resourceloader: Use 'enableModuleContentVersion' for startup module" 2018-09-04 12:41:47 +00:00
Kunal Mehta
3394368bc5 SpecialPageExecutor: Use finally now that we're in a PHP 5.5+ world
Change-Id: I2f91998781be492557d90444b773951ae1e1580e
2018-09-03 22:10:55 -07:00
Tim Starling
0ecfe75502 Introduce NameTableStoreFactory
With a separate service for each of the NameTableStore tables, it
wasn't possible to instantiate a NameTableStore for a foreign wiki,
leading to the inelegant situation of having RevisionStoreFactory
construct a new NameTableStoreFactory every time a RevisionStore for a
foreign wiki was requested. These NameTableStore objects were not
tracked in any structured way, so there was no way to reset them for
tests.

So, introduce NameTableStoreFactory, which tracks object instances for
both local and remote table access.

This also avoids having schema details in ServiceWiring.php.

Depends-On: I5c78cfb8bf90eca935a3264592366f63517c4fad
Bug: T202641
Change-Id: Ic0f2d1d94bad9dcc047ff19a1f92db89b7e014ce
2018-09-04 15:08:38 +10:00
jenkins-bot
ecd0a5fce5 Merge "Reset services before every test" 2018-09-04 00:27:07 +00:00
jenkins-bot
b57de66463 Merge "Avoid constructing Title objects in data providers" 2018-09-04 00:23:29 +00:00
jenkins-bot
32a243c457 Merge "registration: Add ability to check if a specific extension version is loaded" 2018-09-03 22:07:08 +00:00
MGChecker
eb6b4d8e7e registration: Add ability to check if a specific extension version is loaded
As it's quite common that extensions and skins interact with each other, it's
useful to have a simple way to check if an extension version satisfies a
given constraint, as extensions change over time.

Bug: T202955
Change-Id: I19f9713caf89d647072a2bd7d598e739be383f4a
2018-09-03 14:37:33 -07:00
Tim Starling
5322107191 Reset services before every test
Trying to avoid resetting services introduces a lot of complexity and
several bugs. We were doing a reset for 70% of @group Database tests
anyway.

Instead:

* Reset services at the start of MediaWikiTestCase::run().
* Capture the actual original service container instead of making a
  special shared service container.
* The test-isolated local service container can now only be initialised
  non-statically. Revert the recent conversion of overrideMwServices()
  to static.
* Store a reference to the local service container in the test case
  object. In MediaWikiTestCase, always use the original or local service
  container directly, to avoid confusion about which one is active at
  the time.
* Remove a lot of unnecessary teardown
* Always call ServiceContainer::destroy() before forceGlobalInstance()
  since the memory is not otherwise freed.

Change-Id: I4a17c1c7ec92c14e3bc471f0216473ebe19477b9
2018-09-03 16:38:58 +00:00
daniel
2d5b2f0f6a Avoid constructing Title objects in data providers
Bug: T202641
Change-Id: I34efa0b9329e740bcb292b2529ec8f7f925dc346
2018-09-03 16:36:49 +00:00
Zoranzoki21
1f2e9c1b54 Fix common typos in code
Bug: T201491
Change-Id: Id962b79f2590c51380cb977e727b7548abc11d33
2018-09-02 09:03:07 +00:00
jenkins-bot
c8c44f7f49 Merge "Fix wfDebug() test so that it works with overridden SPI" 2018-08-31 20:42:43 +00:00
jenkins-bot
8cea6e052c Merge "Title: Fix isRawHtmlMessage() for messages with underscores" 2018-08-31 17:39:51 +00:00
Kunal Mehta
9e5edca6c5 Title: Fix isRawHtmlMessage() for messages with underscores
Title::getRootText() uses the text form (spaces) of the title, while
$wgRawHtmlMessages was specifying them in dbkey form (underscores).

And add tests while we're at it. Which spotted that the existing
code didn't work. Whoops. Fixed.

Change-Id: I05eea553c588e0f99f862e07ad15386507ed0728
2018-08-31 09:45:01 -07:00
Brad Jorsch
07530dfb63 ApiComparePages: Clean up handling of slot deletion
We can't allow the main slot to be deleted. DifferenceEngine assumes it
exits.

We also shouldn't allow parameters such as `tosection-{role}` to be used
without the corresponing `totext-{role}`. This will help prevent people
from being confused into thinking that `tosection-{role}` will do
anything in that situation (as opposed to `tosection`, which did).

Bug: T203255
Change-Id: I58573bb2c1ee68e6907ef2e88385fe36e5184076
2018-08-31 11:26:07 -04:00
jenkins-bot
a76baefe8e Merge "Make HTML generation in RenderedRevision optional" 2018-08-31 11:38:15 +00:00
jenkins-bot
bbebfebacc Merge "Add test for {{subst:REVISIONUSER}}" 2018-08-31 11:38:10 +00:00
jenkins-bot
a3357744c3 Merge "[MCR] Introduce RevisionRenderer" 2018-08-31 11:25:15 +00:00
daniel
8a650c4aca Add test for {{subst:REVISIONUSER}}
This tests that revision meta-data is available for Pre-Save Transform.

Change-Id: I62f73ea24784b539cdf8229aeb1f8efa62631248
2018-08-31 12:49:19 +02:00
daniel
d8c409dd16 Make HTML generation in RenderedRevision optional
This allows optimization for situations in which a caller
needs the meta-data of a ParserOutput, and the respective
ContentHandler can provide that meta-data without generating
HTML output.

Bug: T194048
Change-Id: I786d294d18a6a2e3cea61577313e21b578c44f1e
2018-08-31 10:48:41 +00:00
Tim Starling
6d1ea3e057 Fix wfDebug() test so that it works with overridden SPI
Fix testDebugFunctionTest() so that it works when LocalSettings.php
sets $wgMWLoggerDefaultSpi

Change-Id: I5e573b0ce1ce037c3505d3b44d9710395c9af8d6
2018-08-31 15:02:38 +10:00
jenkins-bot
486905a17f Merge "Allow tests to run with a non-writable source tree" 2018-08-31 00:48:34 +00:00
Timo Tijhof
b70ab40839 resourceloader: Use 'enableModuleContentVersion' for startup module
This significantly simplifies the getVersionHash implementation for
StartupModule, and fixes a couple of bugs.

Previously, the startup module's E-Tag was determined by the
'getDefinitionSummary' method, which combined the E-Tag values
from all registered modules, plus what we thought is all information
used by 'getScript' (config vars, embedded script files, list
of base modules, ...)

However, this were various things part of the manifest that it
forgot about, including:

* Changes to the list of dependencies of a module.
* Changes to the name of module.
* Changes to the cache group of module.
* Adding or removing a foreign module source (mw.loader.addSource).

These are all quite rare, and when they do change, they usually
also involve a change that *was* tracked already. But, sometimes
they don't and that's when bugs happened.

Instead of the tracking array of getDefinitionSummary, we now
use the 'enableModuleContentVersion' option for StartupModule,
which simply calls the actual getScript() method and hashes that.

Of note: When an exception happens with the version computation of
any individual module, we catch it, log it, and continue with the
rest. Previously, the first time such error was discovered at
run-time would be in the getCombinedVersion() call from
StartupModule::getAllModuleHashes(). That public getCombinedVersion()
method of ResourceLoader had the benefit of also outputting details
of that exception in the HTTP response output. In order to keep that
behaviour, I made outputErrorAndLog() public so that StartupModule
can call it directly now. This is covered by
ResourceLoaderTest::testMakeModuleResponseStartupError.

Bug: T201686
Change-Id: I8e8d3a2cd2ccd68d2d78e988bcdd0d77fbcbf1d4
2018-08-31 00:23:23 +00:00
Timo Tijhof
e42837e977 resourceloader: Remove selective build optimisation from getModuleContent()
This follows 5ddd7f91c7, which factored out response building
from ResourceLoader.php to ResourceLoaderModule::buildContent.
As optimisation, I made this method only return the array keys
needed for the current response; based $context->getOnly().

The reason for this refactoring was the creation of the
'enableModuleContentVersion' option to getVersionHash(), which
would use this method to create a module response, and hash it.

During the implementation of that option, I ran into a problem.
getVersionHash() is called by the startup module for each
registered module, to create the manifest. The context for the
StartupModule request itself has "only=scripts". But, we must
still compute the version hashes for whole modules, not just
their scripts.

I worked around that problem in aac831f9fa by creating a mock
context in getVersionHash() that stubs out the 'only' parameter.

This worked, but made the assumption that the scripts and styles
of a module cannot differ based on the 'only' parameter.
This assumption was wrong, because the 'only' parameter is part
of ResourceLoaderContext and available to all getters to vary on.
Fortunately, the 'enableModuleContentVersion' option is off by
default and nobody currently using it was differing its output
by the 'only' parameter.

I intend to make use of the 'enableModuleContentVersion' option
in StartupModule to fix T201686. And StartupModule outputs a
manifest if the request specifies only=scripts, and outputs
a warning otherwise. As such, it cannot compute its version
if the 'only' parameter is stubbed out.

* Remove the 'only' parameter stubbing.
* Remove the selective building from the buildContent() method.
  This was not very useful because we need to build the whole
  module regardless when computing the version.

As benefit, this means the in-process cache is now shared between
the call from getVersionHash and the call from makeModuleResponse.

Bug: T201686
Change-Id: I8a17888f95f86ac795bc2de43086225b8a8f4b78
2018-08-30 21:02:57 +00:00
daniel
e9f71517f7 [MCR] Introduce RevisionRenderer
RevisionRenderer is the MCR replacement for Content::getParserOutput,
as outlined in <https://www.mediawiki.org/wiki/User:Daniel_Kinzler_(WMDE)/MCR-PageUpdater>.

Note: This change also introduces quite a bit of code for
merging ParserOutput objects.

Bug: T194048
Change-Id: I871978bf79f67c9e7954fb3fc8528d6e365f2cc1
2018-08-30 19:15:12 +02:00
Tim Starling
11278f848d Allow tests to run with a non-writable source tree
It's insecure to allow apps to modify their own source, that's how file
write vulnerabilities escalate to code execution.

Change-Id: I0f79b2b7c7502405a62dcb176d8be4633ce4eda5
2018-08-30 10:48:50 +10:00
Timo Tijhof
15d6bffb56 Html: Reject </script> from inlineScript() and leave rest unescaped
There are three problems with the CDATA approach:

1. It doesn't work.

   HTML5 already interprets the contents of <script> tags as CDATA,
   which means escaping of characters like & is not needed. In fact,
   in HTML5 mode, a plain script tag with <script>0&amp;1;</script>
   would be a syntax error. Indicating it is not interpreted as
   text, but as CDATA. Effectively, the only thing an HTML parser
   looks for is </script>.

   And that's exactly the problem. Producing an inline script
   containing the characters "</string>" for legitimate reasons,
   is currently broken.
   No alternate wrapping or setting can make it work, either.

   See also:
   https://people.wikimedia.org/~krinkle/200506-html-inlinescript.html
   which contains:

   <script>/*<![CDATA[*/
   if (true && true) {
     console.log('This is a <script></script> tag (original)');
   }
   /*]]>*/</script>

   In a browser, the script is terminated by the first "</script>",
   leaving the code unfinished, throwing a SyntaxError, and outputting
   the rest of the script as plain text on the page.

2. CDATA is only for XML mode, whereas MediaWiki does not support
   the XML/XHTML output mode (since MediaWiki 1.22). Instead, we only
   output HTML (5). Code that does need to produce XML, should use the
   class from Xml.php instead.

3. It gives a false sense of security.

We could just remove the CDATA code as-is and that in itself would be an
improvement per point 2 and 3, and would break nothing per point 1.

However, this commit attempts to address the underlying bug by rejecting
the characters "</script>" from input. If this is needed in a literal,
it is the responsibility of the caller to escape it in a way that is
appropiate for how it is used (string, comment, regex, etc.).

There are two ways this can be used currently in core:

* User input as exported through JSON (e.g. mw.config, or mw.messages).
  This is already fine as both FormatJson::encode and json_encode handle
  escape either < or / in the string by default already.

* Previews of edits to user scripts. This is currently already broken and
  causes the script to end early and produce arbitrary HTML on the page.
  This commit limits the impact by refusing to output such script in a
  broken way. I will further address that use case in a follow-up.

Bug: T200506
Change-Id: I67ceb34eabf2f62fd3f3841b8f1459289fad28fb
2018-08-30 00:10:35 +01:00
jenkins-bot
ba6c827485 Merge "Apply content wrapping in ParserOutput::getText()" 2018-08-29 16:25:22 +00:00
jenkins-bot
6abd0c0c3b Merge "Add tests for article viewing" 2018-08-29 15:29:21 +00:00
daniel
0dc7ba02b4 Apply content wrapping in ParserOutput::getText()
Instead of applying wrapping the the parser and unwrapping in
ParserOutput::getText(), turn this around and apply wrapping in getText(),
and only if desired.

This avoids search&replace logic for unwrapping, and it also makes it a lot
easier to merge the output of multiple slots for MCR output.

This changes behavior in two hopefully irrelevant ways:
1) the limit report comments will be inside the wrapper div, instead of
following it.
2) if HTML with a wrapper div is explicitly injected into a ParserOutput
object, it will not be possible to unwrap the text.

Bug: T174035
Change-Id: I1641b7995af9bd297f1acd610d583fbf874f34e0
2018-08-29 16:46:25 +02:00
jenkins-bot
918f21d8b5 Merge "resourceloader: Remove unused static SkinModule::getLogo method" 2018-08-29 10:34:52 +00:00
jenkins-bot
065bec63ea Merge "resourceloader: Move logo preload from OutputPage to SkinModule" 2018-08-28 23:07:00 +00:00
Timo Tijhof
3ff2615992 resourceloader: Remove unused static SkinModule::getLogo method
This existed for internal use by OutputPage, which is no longer
the case as of I11b390f2e4f5e7db.

Also move the unit tests from OutputPageTest,
to ResourceLoaderSkinModuleTest.

Change-Id: I8b23f976f5f89b1005b387a827f75031f5c96141
2018-08-28 23:50:50 +01:00
daniel
9b6a3dcb1d Add tests for article viewing
Bug: T174035
Change-Id: I06dc78853169812b17e0bde733d9306ccd687564
2018-08-28 19:22:26 +02:00
jenkins-bot
709b415682 Merge "Set migration stages in RevisionStoreDbTestBase" 2018-08-28 09:39:15 +00:00
Tim Starling
3624259efb Set migration stages in RevisionStoreDbTestBase
I confirmed that wgCommentTableSchemaMigrationStage needs to be set, and
getActorQueryFields() implies that the actor table migration stage needs
to be set as well.

Change-Id: I153ff985c8753b291d2201ebeed10515acb0cd36
2018-08-28 15:41:08 +10:00
Timo Tijhof
5d0b5a402e resourceloader: Move logo preload from OutputPage to SkinModule
This was introduced in OutputPage before support for getPreloadLinks()
was added to ResourceLoader. The introduction in ResourceLoader was
actually inspired by this original implementation.

Now that we have it, we should make use of it for this module
as well. Doing so has several benefits:

* Makes the code cleaner by not requiring every skin to implement
  the extra boolean method. Instead, it naturally works. If
  the skin loads the SkinModule, it gets the preload as well.
  If not (such as Minerva, which has a different logo config),
  then it also doesn't get the preload link.
  Naturally, automatic.

* Makes code cleaner by not having static methods, and by not
  having OutputPage call into a Module class.

* Fixes the problem where, if a site's logo is changed, all cached
  HTML is preloading the old logo whilst the stylesheet fetches
  the newer one. Causing both to be downloaded.

* Still preloads the logo well before it can render.

Change-Id: I11b390f2e4f5e7db8b4506ab547839152888005c
2018-08-27 23:05:51 +00:00
Kunal Mehta
8a3bdfc633 Support nested arrays in StaticArrayWriter
This is needed by LCStoreStaticArray.

Bug: T200626
Change-Id: I76abd3849381b3b98e350a4627f3515eeb00fa2d
2018-08-27 22:23:02 +00:00
jenkins-bot
c112c30346 Merge "Fix DifferenceEngine revision loading logic" 2018-08-24 18:24:08 +00:00
Gergő Tisza
b7ed112908
Fix DifferenceEngine revision loading logic
Bug: T201218
Bug: T202454
Change-Id: I867900190cb45b983e89769c7fc0f965e2651918
2018-08-24 13:20:07 +02:00
daniel
4b4afe7cbe Avoid joins when reading MCR revisions.
When loading revision slots from the new MCR schema, slot role names
and content model names need to be resolved. Doing so programmatically
based on an in-memory cache avoids having to join against two additional
table every time we load slot meta-data.

This relies on NameTableStore, which was designed for exactly this use
case.

Bug: T198561
Change-Id: Ic005931b669f9d0173ef47ac17331d44fb1141ca
2018-08-23 16:57:50 -07:00
jenkins-bot
60e94c767c Merge "Don't reset name tables between test runs." 2018-08-23 19:41:16 +00:00
jenkins-bot
109b8fb65d Merge "Make sure we don't try to use a deleted rev ID." 2018-08-23 18:10:57 +00:00
daniel
2c7e4adcea Don't reset name tables between test runs.
Resetting the content_model and slot_role tables between test runs
requires the corresponding NameTabelStore instances to be reset
as well. We may however have many of them, buried in various services.
There is no easy way to reset them consistently.

Letting information in these tables persist between tests seems
harmless. Tests that need these tables reset can simply add them
to the tablesUsed array.

This is needed for unit tests to work with the new MCR schema.

Bug: T198561
Change-Id: I63e61e1ab74e00c20930a83d3a3f5df53092a197
2018-08-23 19:15:33 +02:00
Brad Jorsch
1ab2f7a56b ApiComparePages: Update for MCR
The main external change here is that it can now return diffs per slot,
and the various parameters for providing text are deprecated in favor of
templated per-slot versions.

Also, this deprecates the 'fromsection' and 'tosection' behavior
introduced for T183823 (extracting a section's content for the diff) in
favor of the more logical behavior requested in T185723 (expanding
'fromtext-{slot}'/'totext-{slot}' as if for a section edit).

Bug: T200569
Bug: T183823
Bug: T185723
Change-Id: I700edfa766bbc320887f2e0b7507fcdb11e72cdc
2018-08-23 14:56:10 +00:00
Brad Jorsch
5799b2f001 Make sure we don't try to use a deleted rev ID.
MySQL until 8.0 and MariaDB until some version after 10.1.34 don't save
the auto-increment value to disk, so on server restart it might reuse
IDs from deleted revisions. We can fix that with an insert with an
explicit rev_id value, if necessary.

Bug: T202032
Change-Id: I14e5b6c8ec8b5f1aeb2305fae4b103665f8f6686
2018-08-22 15:32:16 -04:00
jenkins-bot
f1480bac4c Merge "Improve test coverage for ApiStashEdit" 2018-08-22 05:09:24 +00:00
jenkins-bot
db7ed1a6ef Merge "TitleFormatter: Implement fbc1449653 and unify prefix logic" 2018-08-22 04:53:26 +00:00
Aryeh Gregor
ab94b63526 Improve test coverage for ApiStashEdit
Change-Id: I1b7d95e074a7f101d13398a32898b74145ab4056
2018-08-21 15:32:29 -07:00
jenkins-bot
94e37b85af Merge "[MCR] Render multi-slot diffs" 2018-08-21 14:04:56 +00:00
jenkins-bot
88166887e4 Merge "tests: Replace Bugddddd with Tddddd in test names, test strings" 2018-08-20 21:55:28 +00:00
Fomafix
186c984ab6 tests: Replace Bugddddd with Tddddd in test names, test strings
Change-Id: Ic6fbc5e14b1a756f62dd6cc3a6b2acc0d47db498
2018-08-20 21:27:20 +00:00
Gergő Tisza
d31580eeb0
[MCR] Render multi-slot diffs
Move logic for rendering a diff between two content objects out of
DifferenceEngine, into a new SlotDiffRenderer class. Make
DifferenceEngine use multiple SlotDiffRenderers, one per slot.

This separates the class tree for changing high-level diff properties
such as the header or the revision selection method (same as before:
subclass DifferenceEngine and override ContentHandler::getDiffEngineClass
or implement GetDifferenceEngine) and the one for changing the actual
diff rendering for a given content type (subclass SlotDiffRenderer and
override ContentHandler::getSlotDiffRenderer or implement
GetSlotDiffRenderer). To keep B/C, when SlotDiffRenderer is not overridden
for a given content type but DifferenceEngine is, that DifferenceEngine
will be used instead.
The weak point of the scheme is overriding the DifferenceEngine methods
passing control to the SlotDiffRenderers (the ones calling
getDifferenceEngines), without calling the parent. These are:
showDiffStyle, getDiffBody, getDiffBodyCacheKeyParams. Extensions doing
that will probably break in unpredictable ways (most likely, only
showing the main slot diff). Nothing in gerrit does it, at least.

A new GetSlotDiffRenderer hook is added to modify rendering for content
models not owned by the extension, much like how GetDifferenceEngine
works.

Also deprecates public access to mNewRev/mOldRev and creates public
getters instead. DifferenceEngine never supported external changes to
those properties, this just acknowledges it.

Bug: T194731
Change-Id: I2f8a9dbebd2290b7feafb20e2bb2a2693e18ba11
Depends-On: I04e885a33bfce5bccc807b9bcfe1eaa577a9fd47
Depends-On: I203d8895bf436b7fee53fe4718dede8a3b1768bc
2018-08-20 15:39:12 +02:00
Kunal Mehta
379407a640 Support a heading of '0' in Html::messageBox()
Change-Id: I181cb6f92ab1b10d87b1213a043a5f291149d094
2018-08-19 21:46:21 -07:00
jenkins-bot
5f7e96fdad Merge "Improve StaticArrayWriterTest and add missing @covers tag" 2018-08-19 17:07:13 +00:00
jenkins-bot
10064e0a79 Merge "Create and use PrefixingStatsdDataFactoryProxy in PerDbNameStatsdDataFactory" 2018-08-19 07:51:39 +00:00
jenkins-bot
eaa34630f4 Merge "CSP: In tests, use setMwGlobals() instead of manual set+undo" 2018-08-19 07:40:05 +00:00
addshore
82b19bd96a Create and use PrefixingStatsdDataFactoryProxy in PerDbNameStatsdDataFactory
MediaWiki::emitBufferedStatsdData() is never called for the PerDbName factory,
so stats were being dropped. Instead of having two factories, turn the
PerDbName one into a proxy/wrapper around the main factory that just adds a
prefix in front of all of the keys.

Bug: T202144
Change-Id: I31e376446abb58e41353b4ca3814120d2e914104
2018-08-19 00:19:57 -07:00
Kunal Mehta
81f4eb4b71 Improve StaticArrayWriterTest and add missing @covers tag
Checking for proper quoting was suggested by Krinkle in CR.

Change-Id: I7fa599767017a5cfc82899bc4178de6cb34bdd02
2018-08-19 00:07:03 -07:00
Timo Tijhof
c83e2445b8 CSP: In tests, use setMwGlobals() instead of manual set+undo
This is the idiom as used in other PHPUnit tests for MediaWiki.

Change-Id: I285e5abe57bad8b9a8a3b35d81bb3a9f5f3dbe85
2018-08-19 01:43:52 +01:00
Kunal Mehta
3b1e8a5cef Move wfMakeStaticArrayFile() into a class
And include tests :)

This code is independent of MediaWiki, but not really large enough to be
worth librarizing right now.

Bug: T200626
Change-Id: I022c074e8a708fb5219bc4ff4b53e7e31f60dc4b
2018-08-17 22:48:19 -07:00
jenkins-bot
fd08137ebf Merge "Turn ApiPrefixUniquenessTest into a structure test" 2018-08-18 00:55:18 +00:00
Kunal Mehta
63b2003520 TitleFormatter: Implement fbc1449653 and unify prefix logic
fbc1449653 (Make Titles with an unknown namespace ID refer to
Special:Badtitle.) was never implemented in TitleFormatter, so let's do
that.

While we're at it, formatTitle() is now structured in the same format as
Title::prefix(), to make it easier to compare code between the two
implementations. The existing tests verify that this is a no-op. There's
a little extra indirection in getPrefixedDBkey(), which now goes through
dbkeyform -> textform -> dbkeyform, but reduces duplication of code,
which I think is worth it.

Bug: T165149
Change-Id: I4e43487a52663d2a647f9e71d487f58e25474f7a
2018-08-17 17:43:52 -07:00
Kunal Mehta
72b4099727 Turn ApiPrefixUniquenessTest into a structure test
This way it gets run during extension test runs as well.

Temporarily add a hack allowing 'wbeu' duplicates until T196962 is fixed.

Change-Id: Ic89a22a2ff4525585de9e290a1d47d22cfaaac5e
2018-08-17 14:19:41 -07:00
jenkins-bot
352854ee0f Merge "Mass conversion to SpecialPageFactory service" 2018-08-17 21:02:58 +00:00
jenkins-bot
26e8ff6352 Merge "JavaScriptMinifier: Fix bad state after ternary in object literal" 2018-08-17 19:10:10 +00:00
Aryeh Gregor
e68fdb4065 Mass conversion to SpecialPageFactory service
Change-Id: Ia6e1e819ec6cbe8bf75b820109f51d47863e31fc
2018-08-17 12:03:12 -07:00
jenkins-bot
532b15c800 Merge "Make SpecialPageFactory a service" 2018-08-17 18:53:27 +00:00
Aryeh Gregor
d4045035b0 Make SpecialPageFactory a service
Calling SpecialPageFactory methods statically is now soft-deprecated.

SpecialPageFactory::resetList() is a no-op, and I changed tests
in core to use overrideMwServices() instead.

Methods that fell back to $wgUser now require a User object being passed.

Depends-On: Ie1f80315871085b9fd4763a265b588849d94414d
Change-Id: Id8a92d57743f790b7d8c377c033cef38d1bb24de
2018-08-17 11:12:23 -07:00
addshore
babb418439 RevisionStoreDbTestBase, remove redundant needsDB override
The Database group is used, so the default implementation
of needsDB will already return true.

Change-Id: I32f6a9713f4ef999debab56d4f63860f9e02f177
2018-08-17 12:46:20 +00:00
jenkins-bot
38a0733fef Merge "Html: Add test coverage for inlineScript()" 2018-08-17 01:08:26 +00:00
Timo Tijhof
15110b1ca9 JavaScriptMinifier: Fix bad state after ternary in object literal
The following pattern of input (found in jquery.js) triggered
this bug:

    call( {
        key: 1 ? 0 : function () {
            return this;
        }
    } );

The open brace changes state to PROPERTY_ASSIGNMENT (for object literals).
The colon after 'key' sets state to PROPERTY_EXPRESSION.

Each individual parts of an expression (identifiers and literal values)
is recognised with state *_EXPRESSION_OP, such as PROPERTY_EXPRESSION_OP.

The '1' after 'key:' correctly sets the state to PROPERTY_EXPRESSION_OP.
Upto there it goes well, but after that it goes wrong.

The question mark (TYPE_HOOK) in this context was wrongly switching
back to PROPERTY_EXPRESSION. That is a problem because that does not
handle TYPE_COLON, which meant '0: function' was seen together as a
sequence of continuous PROPERTY_EXPRESSION_OP where TYPE_FUNC may
not be handled.

Fixed by changing handling of TYPE_HOOK in PROPERTY_EXPRESSION to
switch states to EXPRESSION_TERNARY, and also performing a push
so that ternary handling can pop back to the property expression.

This mirrors the handling that already exists for ternaries in
the regular handling of EXPRESSION/EXPRESSION_OP (as opposed to
the variant for object literal properties).

Bug: T201606
Change-Id: I6104c839cfc3416257543b54a91b74cb4aa4193b
2018-08-16 17:02:07 +00:00
Timo Tijhof
7f843b0c04 title: Disable the failing tests from TitlePermissionTest
Bug: T201776
Change-Id: I088bd797225e0c60c66de4d4d1aa12d0b5bf67d8
2018-08-16 13:05:09 +00:00
jenkins-bot
7da455154e Merge "rdbms: use Database::getDomainId for transaction logging calls" 2018-08-16 05:54:35 +00:00
petarpetkovic
b7a4e82545 Fix some of the common typos
* supress -> suppress (Except in backup_LogTest.php)
* recomend -> recommend
* becuase -> because
* accross -> across

Bug: T201491
Change-Id: I8faa4e6cc688b3ee204b3f79ab55eb7b65cc1fdd
2018-08-16 00:59:32 +02:00
Aaron Schulz
5358c41e86 rdbms: use Database::getDomainId for transaction logging calls
Change-Id: I360ca633b145dc8e510bb00b542ac44933283943
2018-08-15 01:29:39 -07:00
jenkins-bot
757e55265d Merge "MergeHistory: Fix flaky test due to relative timestamp" 2018-08-15 03:27:48 +00:00
jenkins-bot
329a72120e Merge "resourceloader: Remove $wgResourceLoaderLESSVars support" 2018-08-15 01:24:36 +00:00
Timo Tijhof
4c9fd03240 MergeHistory: Fix flaky test due to relative timestamp
In PHP, `strtotime('tomorrow')` evaluates to the first midnight
after the current time.

Which means on Aug 14 at 23:59:59, strtotime('tomorrow') refers
to a timestamp merely 1 second in the future (Aug 15 00:00:00).

This causes the test to fail because this timestamp is computed
in a data provider, before the test itself starts. In order to
pass, it needs to be far enough in the future that it will also
be after the point in time where the test creates the page and
revisions in question.

Fix this by:
* ... moving it into the test itself, where even plain time()
      should probably suffice, but that's for another time.

* ... using +24*3600 instead of strtotime().

Bug: T201976
Change-Id: Ice5d54af4fb7cffa8db9b657796ba6ebecdaffa0
2018-08-15 02:16:02 +01:00
jenkins-bot
c1d7412ce2 Merge "Parser: Call firstCallInit() in getTags/getFunctionHooks" 2018-08-15 00:49:40 +00:00
jenkins-bot
a0b490bbe7 Merge "password: Move commonpasswords.cdb to includes/password/" 2018-08-14 23:53:19 +00:00
Kunal Mehta
b7b8f214bb Parser: Call firstCallInit() in getTags/getFunctionHooks
So callers don't need to do this manually. Pointed out by Tim in T201799.

Depends-On: Ia6c36d5a650095e35093bf47e275e081e89b3daf
Change-Id: Ida62767f3ca53f99609cae01d3a20051bb92ccab
2018-08-14 14:16:42 -07:00
Timo Tijhof
ca510f742f resourceloader: Remove $wgResourceLoaderLESSVars support
The use of global variables was deprecated in favour of
ResourceLoaderModule::getLessVars() on a per-module basis.

Also moved testLessFileCompilation case to the appropiate file as it
covers ResourceLoaderFileModule.php, not ResourceLoader.php.

Bug: T140804
Depends-On: Ib1b2808df2384473bfac47f53a5d25d7c9bbca2b
Depends-On: I96047f69d01c4736306df2719267e6347daf556f
Change-Id: If708087c85c80355c7e78f1768529b5f2e16ed07
2018-08-14 18:57:45 +00:00
Fomafix
0a0d5cb7f7 Fix typos
Bug: T201491
Change-Id: I25a27d11faabe2f5fa02950c7a4fb58b13fb3662
2018-08-14 09:52:19 +00:00
jenkins-bot
dccec12761 Merge "Make MapCacheLRU throw errors for bad $field arguments" 2018-08-14 01:17:17 +00:00
Aaron Schulz
39a63a3c16 Make MapCacheLRU throw errors for bad $field arguments
Change-Id: Ibde33e0ff671d3428b73c66766478f58763726e1
2018-08-14 00:41:33 +00:00
Kunal Mehta
c001d65a3a Call overrideMwServices() in TitlePermissionTest
Bug: T201776
Change-Id: I59918311e3dd01d133d5acebf8d1907fe8aef818
2018-08-12 19:46:23 -07:00
jenkins-bot
8d91ac5f12 Merge "Add PHPUnit test to ApiQueryDisabled" 2018-08-12 22:50:15 +00:00
jenkins-bot
cd789d78b8 Merge "JavaScriptMinifier: Add test case for another line-break bug" 2018-08-12 17:51:55 +00:00
jenkins-bot
d2db6c2f12 Merge "JavaScriptMinifier: Move test case for 'x++' to provideLineBreaker()" 2018-08-12 09:45:57 +00:00
jenkins-bot
9bd9b2f02b Merge "SpecialMyLanguage: Get content language from service" 2018-08-12 06:50:07 +00:00
jenkins-bot
3e5be2f38a Merge "Give pages with ~~~~ a different cache TTL" 2018-08-12 06:43:52 +00:00
Aryeh Gregor
f2e3c4d09f Give pages with ~~~~ a different cache TTL
This was supposed to already be the case, but it wasn't. The flag that
was set got cleared and never did anything.

Change-Id: Ide960f8cb9228f9a9d68c540369f122ada0a2a6f
2018-08-12 06:19:51 +00:00
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
Timo Tijhof
92ce940ec3 JavaScriptMinifier: Add test case for another line-break bug
Discovered by adding a test case that uses file_get_contents()
to pass jquery.js, and then scan the PHPUnit output for an entry
containing `return` by itself on a line where the next line
is isn't `;` - then reducing it to a test case as small as possible.

This was reduced from the definition of jQuery.event.addProp.

Bug: T201606
Change-Id: I1f907436c32630102e60e3ded7092dbeb9669fe8
2018-08-12 00:24:56 +01:00
Timo Tijhof
da3aa28cea JavaScriptMinifier: Move test case for 'x++' to provideLineBreaker()
Easier to read.

Bug: T201606
Change-Id: Ie12910edf5ab6a9d7246000ca78a3c9208aeb152
2018-08-12 00:24:10 +01:00
jenkins-bot
0700becfa2 Merge "JavaScriptMinifier: Fix bad state after '{}' in property value" 2018-08-11 15:40:43 +00:00
jenkins-bot
dbe51d6546 Merge "JavaScriptMinifier: Add better line-breaker tests" 2018-08-11 15:40:35 +00:00
jenkins-bot
23d28c0115 Merge "Use ParserFactory in a bunch of places" 2018-08-11 07:52:16 +00:00
jenkins-bot
5e2d030675 Merge "Clean up AuthManagerTest a bit" 2018-08-11 07:41:20 +00:00
Aryeh Gregor
bca6085920 Use ParserFactory in a bunch of places
I wasn't sure how to convert the rest of the occurrences in core (there
are a significant number).

Bug: T200881
Change-Id: I114bba946cd3ea8a293121e275588c3c4d174f94
2018-08-11 00:16:17 -06:00
Aryeh Gregor
62515f7b15 Introduce ParserFactory service
Bug: T200881
Change-Id: I257e78200983cb10afb76de1f07dd1b9d531c52a
2018-08-11 00:15:52 -06:00
jenkins-bot
7025765f3f Merge "Improve MediaWikiVersionFetcherTest" 2018-08-11 01:01:15 +00:00
Timo Tijhof
1f5f6fc204 JavaScriptMinifier: Fix bad state after '{}' in property value
Previously, $push contained:

	self::PROPERTY_EXPRESSION_OP => [
		self::TYPE_PAREN_OPEN => self::PROPERTY_EXPRESSION_OP
	],

But $pop contained:

	self::PROPERTY_EXPRESSION_OP => [ self::TYPE_BRACE_CLOSE => true ]

This meant that when a closing brace was found inside a property
expression, it would wrongly pop the stack, eventhough we are still
inside the property expression.

The impact is that everything after this is one level higher in
the stack than it should be, causing various other types to be
misinterpreted. Including in the following contrived example:

	call( function () {
		try {
		} catch (e) {
			obj = {
				key: 1 ? 0 : {} // A
			}; // B
		} // C
		return name === 'input';
	} );

In the above, the closing brace at A would close the 'obj.key' assignment
(PROPERTY_EXPRESSION_OP), instead of waiting for the closing brace at B to
decide that.

Then the closing brace at B would wrongly close the 'catch' block (instead of
the 'obj' assignment). And lastly, the closing brace at C would close the
function body (STATEMENT).

This resulted in keyword 'return' being interpreted while in state
PAREN_EXPRESSION_OP instead of STATEMENT, where PAREN_EXPRESSION_OP is the
arguments list to `call()`. In an argument list, TYPE_RETURN is not valid,
which means we stay in that state, instead of progressing to EXPRESSION_NO_NL,
which then wrongly allows for a line break to be inserted.

Bug: T201606
Change-Id: I07b809a7ca56e282ecb48b5c89c217b4b8da6856
2018-08-11 00:16:47 +01:00
Timo Tijhof
8cfe4abf8d JavaScriptMinifier: Add better line-breaker tests
Set maxLineLength to '1' instead of messing with filler content.
This makes it easy to see all potential line-breaks, instead of only
at the 999th offset.

Bug: T201606
Change-Id: I220b145c5bc8e7d1a41efacd2a6cea738545f006
2018-08-10 23:22:49 +01:00
Derk-Jan Hartman
25c293cadc SVG: Allow , as separator in viewBox attribute value
The viewBox attribute of the <svg> element allows both whitespace and
commas to be used as field separators.
https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute

Bug: T194192
Change-Id: Iae9be3e4fad3a8ffa411d7a76eee2f20cc39b718
2018-08-11 00:16:43 +02:00
jenkins-bot
d2b0968551 Merge "JavaScriptMinifier: Add test case for T201606" 2018-08-10 20:58:16 +00:00
Timo Tijhof
53e05f7b9c JavaScriptMinifier: Add test case for T201606
Bug: T201606
Change-Id: I2058765c7f1cfb9e2d644f19e780926d01b9b68c
2018-08-10 21:04:58 +01:00
Aryeh Gregor
0278585c72 Improve MediaWikiVersionFetcherTest
Let's test that the value is actually correct, not just that it's a
string.

Change-Id: I4d76a48696a838ee6882ffce10d024f7518dcd4a
2018-08-10 11:26:57 +03:00
jenkins-bot
1a8838bb6a Merge "Don't require a list of services in tests" 2018-08-10 04:54:17 +00:00
jenkins-bot
01e9cb56e4 Merge "Alphabetize service lists" 2018-08-10 04:51:47 +00:00
Aryeh Gregor
1174776e47 Don't require a list of services in tests
We already have two lists in other files, there's no need for a third.

Change-Id: I516a26e1170834b27aafeb0049a5893ec965d820
2018-08-10 04:28:31 +00:00
Aryeh Gregor
3c45e203a8 Alphabetize service lists
Adding everything at the end makes the list arbitrarily ordered, and
also invites lots of merge conflicts as new things are added.

Change-Id: I58bcca4fa79140f5d5f2f6ef447e67035cc37aae
2018-08-09 22:19:58 -06:00
jenkins-bot
c340e8dc06 Merge "SVG: SVG unit parser support for wider range of number" 2018-08-09 20:36:55 +00:00
Aryeh Gregor
75d0941e7d Tests can't call resetGlobalServices()
They are supposed to call overrideMwServices() instead, per
documentation.  One test does call resetGlobalServices(), probably by
mistake.  It can be private so other tests won't make the same mistake.

Change-Id: I11ed598fcc901d0d9951724f2d210d3a7a1482d2
2018-08-09 17:53:14 +03:00
Timo Tijhof
f6165f2794 Html: Add test coverage for inlineScript()
This asserts current behaviour in preparation for changing it
in a later commit (see T200506).

Bug: T200506
Change-Id: I76fd15c32c763754d0825d02a49de3d9973c4f8f
2018-08-09 14:28:50 +00:00
Aaron Schulz
5938a6efdc rdbms: add more comments and sanity checks for CONN_TRX_AUTOCOMMIT
Change-Id: I69992cf2e2ae3ef62125b0bc733a0cb7274f814e
2018-08-09 01:39:07 +00:00
jenkins-bot
55ffac2024 Merge "objectcache: add "epoch" parameter to WANObjectCache" 2018-08-08 23:16:40 +00:00
jenkins-bot
97015d4ef3 Merge "Remove @override annotation" 2018-08-07 21:14:34 +00:00
Derk-Jan Hartman
77776c943f SVG: SVG unit parser support for wider range of number
- Add support for radix leading numbers like 0.41
- Add support for scientific number notation
- Add support for plus and minus signs
- Add testcases for SVGUnit parsing and scaling

Bug: T201274
Change-Id: I0446b19b0f22851d968c991007e73255f309f4bc
2018-08-07 22:46:12 +02:00
jenkins-bot
0ecbdc15c7 Merge "resourceloader: Give module eval the ContentSecurityPolicy nonce" 2018-08-07 19:36:32 +00:00
jenkins-bot
85928e591e Merge "Remove @abstract annotation" 2018-08-07 17:39:28 +00:00
Brian Wolff
146e9c96ea resourceloader: Give module eval the ContentSecurityPolicy nonce
Previously domEval didn't have CSP nonces, causing it to violate
the policy.

Also removes the meta tag scheme, as I could not make it compatible
with how RL storage works using domEval instead of real eval() and
it didn't provide much protection anyways.

Bug: T196923
Change-Id: I3cd2d7cc295c39b498d0bf37915d4ba167fdd48c
2018-08-07 16:54:40 +00:00
Umherirrender
5d05f1b3fd Remove @abstract annotation
Doxygen does not know about this annotation

Change-Id: I4ad8f81d92574f1e3d91581627ec753f6dd1473d
2018-08-07 12:16:24 +02:00
Umherirrender
2faeb43453 Remove @override annotation
Doxygen does not know about this annotation

Change-Id: I5a2cac83899acd6954caba16da5023fe1ce09c50
2018-08-07 10:15:53 +00:00
Umherirrender
73bf53e94f Remove @uses annotation from XhprofDataTest
The use of a class is visible by the code or @covers

Change-Id: I1acec60da4b524c171686402a01424d66e9fc99f
2018-08-07 12:07:00 +02:00
Tim Starling
10c8cfea30 RemexCompatMunger: Don't call endTag() in case B/b
This was naïve, the linked bug documents a case where endTag() was
called despite children of the p-wrap still being in TreeBuilder's
stack. Instead, wait for the parent of the p-wrap to have endTag()
called on it, I've submitted a patch which will clean up the node in
that case.

Bug: T200827
Change-Id: I34694813eace9cadabf2db8f9ccca83d1368cfad
2018-08-07 14:07:31 +10:00
Aaron Schulz
4af7fbd76a objectcache: add "epoch" parameter to WANObjectCache
This can be used to discard all values before a certain point in
time, such as periods of severe network problems or misconfiguration
that resulted in missed purges.

Change-Id: I612db8f91a5960b912e9f35645a3d3872df47460
2018-08-06 16:43:50 -07:00
Aryeh Gregor
0d6cb475c7 Clean up AuthManagerTest a bit
Change-Id: I7ff08d4e9c8bd716da8c1ba6e004ea9cf874a64b
2018-08-06 19:15:36 +03:00
Umherirrender
d053a7baa7 Remove comment about fixed codesniffer bug
Fix was part of 21.0.0 (or earlier)

Change-Id: I378aea5cac5a2191e859c89a781e64bf647841d7
2018-08-06 17:38:47 +02:00
Fomafix
795a418db5 SpecialMyLanguage: Get content language from service
Also use methods getFallbackLanguages() and equals() from Language
object.

Change-Id: I601a5dfeea3bac7938f9884be65d007955ffb1b2
2018-08-03 20:07:36 +02:00
dcot
1e01bf8a28 Add PHPUnit test to ApiQueryDisabled
This change adds a PHPUnit test to ApiQueryDisabled as requested in T183885.
A PHPUnit test for ApiDisabled was already in place.

Bug: T183885
Change-Id: I7726c27a5ca74ce26f095afd13af4a71babea82e
2018-08-02 21:44:24 -04:00
addshore
f5cc67524d Introduce RevisionStoreFactory & Tests
This is based on I0a8a441b803, which was reverted because it was
incomplete.

Bug: T198701
Change-Id: I3e4a5f1ef687418c06dfc979cfe04da336e876b1
2018-08-02 18:55:29 +00:00
jenkins-bot
67dffb1c90 Merge "Add an explicit check for correct operation to ExifRotationTest" 2018-08-02 15:43:26 +00:00
Kunal Mehta
fb73286fba Add PasswordFactory to MediaWikiServices
Instead of having basically every caller do:
 $pf = new PasswordFactory();
 $pf->init( RequestContext::getMain()->getConfig() );
Just create a single PasswordFactory via MediaWikiServices and pass that
around. Things that want to use their own config can still pass settings
via the new constructor.

This will eventually let us remove the init() function, removing the
only hard dependency upon MediaWiki, to make it easier to librarize
(T89742).

Change-Id: I0fc7520dc023b11a7fa66083eff7b88ebfe49c7b
2018-08-02 14:46:35 +01:00
jenkins-bot
d9327f9a57 Merge "Improve OutputPage test coverage more" 2018-08-02 03:03:22 +00:00
jenkins-bot
49ce67be93 Merge "Introduce ContentLanguage service to replace $wgContLang" 2018-08-02 02:52:23 +00:00
jenkins-bot
62c9cce4bd Merge "Test ApiQuerySiteinfo" 2018-08-02 02:44:38 +00:00
jenkins-bot
07beacf802 Merge "Automatically reset namespace caches when needed" 2018-08-02 02:26:33 +00:00
jenkins-bot
8519fdd110 Merge "New helper ApiTestCase::setExpectedApiException()" 2018-08-02 02:10:59 +00:00
Max Semenik
337564f6dc Add an explicit check for correct operation to ExifRotationTest
Makes debugging test failures way easier than just trying to figure out
what errors a couple lines below mean.

Change-Id: I8e7f6b14cef0954c72b22805eee512051a2b3c86
2018-08-01 18:26:41 -07:00
jenkins-bot
41c2d28e86 Merge "Disable PHPUnit tests that fail under postgres" 2018-08-01 22:50:19 +00:00
jenkins-bot
027160f3aa Merge "Disable PHPUnit tests that fail under sqlite" 2018-08-01 22:50:14 +00:00
Timo Tijhof
553b4b0cd4 password: Move commonpasswords.cdb to includes/password/
Similar to other non-php files used by various classes/libs.

This leaves the serialized/ empty (apart from dotfiles), and as
such the directory was removed.

Change-Id: I538ffe0828843220ac4e161cf2e119deb9bd7ac0
2018-08-01 22:40:30 +00:00