lhc/web/wiklou.git
7 years agoparserTests.php: Fix exit status
Tim Starling [Mon, 12 Sep 2016 06:43:38 +0000 (16:43 +1000)]
parserTests.php: Fix exit status

The return value of Maintenance::execute() is discarded, not used as an
exit status.

Change-Id: I9dd92e43b5b1df1a63d0e8302d360d0bb0f57e7b

7 years agoRelease notes for parser tests refactor
Tim Starling [Mon, 12 Sep 2016 06:29:24 +0000 (16:29 +1000)]
Release notes for parser tests refactor

Change-Id: Ic5cd1e368067024bd264ae991d04f61c58535cd1

7 years agoRefactor parser tests
Tim Starling [Thu, 8 Sep 2016 01:25:22 +0000 (11:25 +1000)]
Refactor parser tests

Merge the PHPUnit parser test runner with the old parserTests.inc,
taking the good bits of both. Reviewed, pared down and documented the
setup code. parserTests.php is now a frontend to a fully featured
parser test system, with lots of developer options, whereas PHPUnit
provides a simpler interface with increased isolation between test
cases.

Performance of both frontends is much improved, perhaps 2x faster for
parserTests.php and 10x faster for PHPUnit.

General:

* Split out the pre-Setup.php global variable configuration from
  phpunit.php into a new class called TestSetup, also called it from
  parserTests.php.
* Factored out the setup of TestsAutoLoader into a static method in
  Maintenance.
* In Setup.php improved "caches" debug output.

PHPUnit frontend:

* Delete the entire contents of NewParserTest and replace it with a
  small wrapper around ParserTestRunner. It doesn't inherit from
  MediaWikiTestCase anymore since integrating the setup code was an
  unnecessary complication.
* Rename MediaWikiParserTest to ParserTestTopLevelSuite and made it an
  instantiable TestSuite class instead of just a static method. Got rid
  of the eval(), just construct TestCase objects directly with a
  specified name, it works just as well.
* Introduce ParserTestFileSuite for per-file setup.
* Remove parser-related options from phpunit.php, since we don't
  support them anymore. Note that --filter now works just as well as
  --regex used to.
* Add CoreParserTestSuite, equivalent to ExtensionsParserTestSuite,
  for clarity.
* Make it possible to call MediaWikiTestCase::setupTestDB() more than
  once, as is implied by the documentation.

parserTests.php frontend:

* Made parserTests.php into a Maintenance subclass, moved CLI-specific
  code to it.
* Renamed ParserTest to ParserTestRunner, this is now the generic
  backend.
* Add --upload-dir option which sets up an FSFileBackend, similar
  to the old default behaviour

Test file reading and interpretation:

* Rename TestFileIterator to TestFileReader, and make it read and buffer
  an entire file, instead of iterating.
* The previous code had an associative array representation of test
  specifications. Used this form more widely to pass around test data.
* Remove the idea of !!hooks copying hooks from $wgParser, this is
  unnecessary now that all extensions use ParserFirstCallInit. Resurrect
  an old interpretation of the feature which was accidentally broken: if
  a named hook does not exist, skip all tests in the file.
* Got rid of the "subtest" idea for tidy variants, instead use a
  human-readable description that appears in the output.
* When all tests in a file are filtered or skipped, don't create the
  articles in them. This greatly speeds up execution time when --regex
  matches a small number of tests. It may possibly break extensions, but
  they would have been randomly broken anyway since there is no
  guarantee of test file execution order.
* Remove integrated testing of OutputPage::addCategoryLinks() category
  link formatting, life is complicated enough already. It can go in
  OutputPageTest if that's a thing we really need.

Result recording and display:

* Make TestRecorder into a generic plugin interface for progress output
  etc., which needs to be abstracted for PHPUnit integration.
* Introduce MultiTestRecorder for recorder chaining, instead of using
  a long inheritance chain. All test recorders now directly inherit from
  TestRecorder.
* Move all console-related code to the new ParserTestPrinter.
* Introduce PhpunitTestRecorder, which is the recorder for the PHPUnit
  frontend. Most events are ignored since they are never emitted in the
  PHPUnit frontend, which does not call runTests().
* Put more information into ParserTestResult and use it more often.

Setup and teardown:

* Introduce a new API for setup/teardown where setup functions return a
  ScopedCallback object which automatically performs the corresponding
  teardown when it goes out of scope.
* Rename setUp() to staticSetup(), rewrite. There was a lot of cruft in
  here which was simply copied from Setup.php without review, and had
  nothing to do with parser tests.
* Rename setupGlobals() to perTestSetup(), mostly rewrite. For
  performance, give staticSetup() precedence in cases where they were
  both setting up the same thing.
* In support of merged setup code, allow Hooks::clear() to be called
  from parserTests.php.
* Remove wgFileExtensions -- it is only used by UploadBase which we
  don't call.
* Remove wgUseImageResize -- superseded by MockMediaHandlerFactory which
  I imported from NewParserTest.
* Import MockFileBackend from NewParserTest. But instead of
  customising the configuration globals, I injected services.
* Remove thumbnail deletion from upload teardown. This makes glob
  handling as in the old parserTests.php unnecessary.
* Remove math file from upload teardown, math is actually an extension
  now! Also, the relevant parser tests were removed from the Math
  extension two years ago in favour of unit tests.
* Make addArticle() private, and introduce addArticles() instead, which
  allows setup/teardown to be done once for each batch of articles
  instead of every time.
* Remove $wgNamespaceAliases and $wgNamespaceProtection setup. These were
  copied in from Setup.php in 2010, and are redundant since we do
  actually run Setup.php.
* Use NullLockManager, don't set up a temporary directory just for
  this alone.

Fuzz tests:

* Use the new TestSetup class.
* Updated for ParserTestRunner interface change.
* Remove some obsolete references to fuzz tests from the two frontends
  where they used to reside.

Bug: T41473
Change-Id: Ia8e17008cb9d9b62ce5645e15a41a3b402f4026a

7 years agoRenames preparatory to parser tests refactor
Tim Starling [Thu, 8 Sep 2016 01:07:06 +0000 (11:07 +1000)]
Renames preparatory to parser tests refactor

Since in several cases, with an all-in-one commit, git's file rename
detection failed, I split the renames out into their own commit to
make review easier. Some changes here won't make complete sense without
the following commit.

* Moved TestsAutoLoader to tests/common/. It will be joined by a friend.
* Renamed ParserTest to ParserTestRunner, since the former name was
  overly generic.
* Renamed TestFileIterator to TestFileReader. Please see the subsequent
  commit for rationale.
* Moved parserTests.php to tests/parser/. It was the only file left in
  tests/, and it should have been moved to tests/parser years ago,
  analogous to phpunit.php.
* Renamed NewParserTest to ParserIntegrationTest. This was a tricky one,
  apparently the name has to end in "Test" or else the structure test
  will fail. Analogous to ParserMethodsTest etc. Rationale: because it's
  not new anymore.
* Renamed MediaWikiParserTest to ParserTestTopLevelSuite and moved it to
  the suites directory. A more descriptive name. Being in suites/
  shields it from StructureTests, and is correct anyway.

Change-Id: Iddc6eaf815fdd64b3addb8570b4b6303ab99d634

7 years agoAvoid "No transaction is active" saveFileDependencies() tests errors
Aaron Schulz [Mon, 12 Sep 2016 03:46:43 +0000 (20:46 -0700)]
Avoid "No transaction is active" saveFileDependencies() tests errors

Unit tests run in CLI mode without DBO_TRX

Change-Id: Icee9cf84cb9e057b329dd3960fcc9b238af478a3

7 years agoMerge "Avoid "Column md_module cannot be null" error in unit tests"
jenkins-bot [Mon, 12 Sep 2016 03:06:17 +0000 (03:06 +0000)]
Merge "Avoid "Column md_module cannot be null" error in unit tests"

7 years agoMerge "Use memory job queue for unit tests"
jenkins-bot [Mon, 12 Sep 2016 01:11:29 +0000 (01:11 +0000)]
Merge "Use memory job queue for unit tests"

7 years agoUse memory job queue for unit tests
Aaron Schulz [Mon, 12 Sep 2016 00:23:54 +0000 (17:23 -0700)]
Use memory job queue for unit tests

Change-Id: I13586b9873bf09acd4a458a7af75a25d9b980fca

7 years agoAvoid "Column md_module cannot be null" error in unit tests
Aaron Schulz [Mon, 12 Sep 2016 00:07:52 +0000 (17:07 -0700)]
Avoid "Column md_module cannot be null" error in unit tests

Change-Id: I06755cbd907d8a595e55080e37779eb9d0c026ab

7 years agoMerge "Display an error message when the validataion of a radio input fails because...
jenkins-bot [Sun, 11 Sep 2016 23:56:41 +0000 (23:56 +0000)]
Merge "Display an error message when the validataion of a radio input fails because user did not provide any input."

7 years agoDisplay an error message when the validataion of a radio input fails because user...
Huji Lee [Sun, 11 Sep 2016 23:38:59 +0000 (19:38 -0400)]
Display an error message when the validataion of a radio input fails because user did not provide any input.

Bug: T107486
Change-Id: Ie3a9cc11f285cadec1dde32f820643d1aabd0d1b

7 years agoMerge "Remove useless LoadBalancer::parentInfo() method and calls"
jenkins-bot [Sun, 11 Sep 2016 23:26:10 +0000 (23:26 +0000)]
Merge "Remove useless LoadBalancer::parentInfo() method and calls"

7 years agoMerge "Use ESTIMATE_DB_APPLY for total transaction time estimate"
jenkins-bot [Sun, 11 Sep 2016 23:16:58 +0000 (23:16 +0000)]
Merge "Use ESTIMATE_DB_APPLY for total transaction time estimate"

7 years agoMerge "Add LBFactory::getChronologyProtectorTouched() method"
jenkins-bot [Sun, 11 Sep 2016 23:08:50 +0000 (23:08 +0000)]
Merge "Add LBFactory::getChronologyProtectorTouched() method"

7 years agoUse ESTIMATE_DB_APPLY for total transaction time estimate
Aaron Schulz [Sun, 11 Sep 2016 22:51:15 +0000 (15:51 -0700)]
Use ESTIMATE_DB_APPLY for total transaction time estimate

Individual write queries already do this, but the COMMIT step
still used the old accounting.

Change-Id: I416a524d6652f933cbc49033b49745db732c8b92

7 years agoRemove useless LoadBalancer::parentInfo() method and calls
Aaron Schulz [Sun, 11 Sep 2016 22:15:34 +0000 (15:15 -0700)]
Remove useless LoadBalancer::parentInfo() method and calls

Change-Id: I3550d1249c63ee5bec51dd343b3e26b515c4827e

7 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Sun, 11 Sep 2016 20:19:31 +0000 (22:19 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I7f5b889fba9e6a54d318b58f68c58179d1f5fba7

7 years agoAdd LBFactory::getChronologyProtectorTouched() method
Aaron Schulz [Thu, 8 Sep 2016 20:07:15 +0000 (13:07 -0700)]
Add LBFactory::getChronologyProtectorTouched() method

This lets callers check whether a user recently change a DB and
possibly try harder to reflect certain changes or refresh caches.

Also simplified some logging code a bit.

Change-Id: Ia1168cf0d46cfdee046838ce4c5a6294e4d81760

7 years agoMerge "Simplify some LoadBalancer methods that do iteration"
jenkins-bot [Sun, 11 Sep 2016 20:06:15 +0000 (20:06 +0000)]
Merge "Simplify some LoadBalancer methods that do iteration"

7 years agoUse DB_REPLICA in ContribsPager
Aaron Schulz [Sun, 11 Sep 2016 13:36:51 +0000 (06:36 -0700)]
Use DB_REPLICA in ContribsPager

Change-Id: Ic225b9c41d989722677caf323846783d7e0638a4

7 years agoSimplify some LoadBalancer methods that do iteration
Aaron Schulz [Sun, 11 Sep 2016 03:10:41 +0000 (20:10 -0700)]
Simplify some LoadBalancer methods that do iteration

Use foreachOpenConnection() and foreachOpenMasterConnection() in
more methods rather that copying that code. Also made the logic
for closeConnection() simpler by using the "serverIndex" field LB
always sets on the connection handles.

Change-Id: I5cb66da2395773d64b84d4115cbcdfc69c9e5e00

7 years agoMerge "Force primary index for RevDelRevisionList query"
jenkins-bot [Sun, 11 Sep 2016 00:49:07 +0000 (00:49 +0000)]
Merge "Force primary index for RevDelRevisionList query"

7 years agoMerge "Revert "Clean up user handling in UploadStash""
jenkins-bot [Sun, 11 Sep 2016 00:35:32 +0000 (00:35 +0000)]
Merge "Revert "Clean up user handling in UploadStash""

7 years agoMerge "Use Database::timestamp in LocalFile::loadFieldsWithTimestamp"
jenkins-bot [Sun, 11 Sep 2016 00:28:14 +0000 (00:28 +0000)]
Merge "Use Database::timestamp in LocalFile::loadFieldsWithTimestamp"

7 years agoForce primary index for RevDelRevisionList query
Roan Kattouw [Mon, 11 Apr 2016 18:08:10 +0000 (11:08 -0700)]
Force primary index for RevDelRevisionList query

To work around an optimizer bug in MySQL where the
index on (rev_page, rev_id) is picked which mysteriously
leads to very slow execution times and timeouts.

In theory, the index being forced here is (rev_id),
which is fine for this query. In WMF production,
it can also be (rev_id, rev_user) (still fine), or
(rev_page, rev_id) (the index we're trying to avoid).
Mysteriously, the optimizer bug doesn't happen if
(rev_page, rev_id) is the primary key, so this still
behaves OK.

Bug: T104313
Change-Id: I15c68ba29309dca8dea274f19389d139a82784aa

7 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Sat, 10 Sep 2016 20:49:05 +0000 (22:49 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I1cf537e516dca258169590bfec492452b2abf956

7 years agoUse Database::timestamp in LocalFile::loadFieldsWithTimestamp
umherirrender [Sat, 10 Sep 2016 20:36:50 +0000 (22:36 +0200)]
Use Database::timestamp in LocalFile::loadFieldsWithTimestamp

Postgres needs a special timestamp format on sql which is handled by
Database::timestamp.

Bug: T145066
Change-Id: I8db958ecbea7c12af8caf8354490e59500975e4b

7 years agomw.ForeignApi: Allow anonymous requests
Bartosz Dziewoński [Sat, 10 Sep 2016 19:01:26 +0000 (21:01 +0200)]
mw.ForeignApi: Allow anonymous requests

When 'anonymous: true' is passed:

* Send 'origin=*' in the query parameters, so that MediaWiki treats
  the request as anonymous (same as for JSONP requests).
* Set 'withCredentials: false' in AJAX options, so that the browser
  doesn't try to send cookies and accepts the response with the
  'Access-Control-Allow-Origin: *' header.

Bug: T145294
Change-Id: Ic93d733cb9e1b1d7301f8975c68ab7ded778845a

7 years agoRevert "Clean up user handling in UploadStash"
Bartosz Dziewoński [Sat, 10 Sep 2016 15:27:49 +0000 (15:27 +0000)]
Revert "Clean up user handling in UploadStash"

This reverts commit 58713d2b1611e55fcd0cf7647af8d96ebc1e88bf.

Bug: T145228
Change-Id: Ic62f19109f98fab9dd029acccecd6518b649e34b

7 years agoMerge "Clean up tests for FauxRequest/WebRequest"
jenkins-bot [Sat, 10 Sep 2016 06:34:19 +0000 (06:34 +0000)]
Merge "Clean up tests for FauxRequest/WebRequest"

7 years agoMake the page JOIN in RevDelRevisionList actually apply
Aaron Schulz [Sat, 10 Sep 2016 06:21:32 +0000 (23:21 -0700)]
Make the page JOIN in RevDelRevisionList actually apply

The table was missing from the tables array

Change-Id: I613a2075e5d18210c8187587462b0f000769aec2

7 years agoClean up tests for FauxRequest/WebRequest
Timo Tijhof [Fri, 9 Sep 2016 22:35:19 +0000 (15:35 -0700)]
Clean up tests for FauxRequest/WebRequest

Follows-up 1ac5474b7b and d18d030d57.

* Always mock WebRequest in WebRequestTest.
  Avoid using FauxRequest, can easily cause false positives (it's already
  avoided in one case of that reason).

* Add a few smoke/integration tests in FauxRequest to make sure the parent
  methods work as expected, given the internal method being overridden
  in FauxRequest.

Change-Id: I1bf528f3c578ecb171a3ff4f17b26f9bb02b4f47

7 years agoMerge "Add more version notes to WANObjectCache"
jenkins-bot [Fri, 9 Sep 2016 21:31:54 +0000 (21:31 +0000)]
Merge "Add more version notes to WANObjectCache"

7 years agoMerge "Chinese Conversion Table Update 2016-6"
jenkins-bot [Fri, 9 Sep 2016 21:26:08 +0000 (21:26 +0000)]
Merge "Chinese Conversion Table Update 2016-6"

7 years agoAdd more version notes to WANObjectCache
Aaron Schulz [Fri, 9 Sep 2016 20:41:03 +0000 (13:41 -0700)]
Add more version notes to WANObjectCache

Change-Id: Ia1b74b568d2b5137c7096a3b4549ac2cd4c7fa93

7 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Fri, 9 Sep 2016 20:22:25 +0000 (22:22 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I0a15f0872c222b8be6576ea43a98cbc14c8c3a1a

7 years agoMerge "objectcache: add "staleTTL" option to WANObjectCache::set()"
jenkins-bot [Fri, 9 Sep 2016 17:38:45 +0000 (17:38 +0000)]
Merge "objectcache: add "staleTTL" option to WANObjectCache::set()"

7 years agoMerge "Hide signup/login/logout links when they would not work"
jenkins-bot [Fri, 9 Sep 2016 15:18:36 +0000 (15:18 +0000)]
Merge "Hide signup/login/logout links when they would not work"

7 years agoMerge "Make $wgRevisionCacheExpiry default to one week"
jenkins-bot [Fri, 9 Sep 2016 10:37:49 +0000 (10:37 +0000)]
Merge "Make $wgRevisionCacheExpiry default to one week"

7 years agoMerge "JsonContentHandler: Make sure makeEmptyContent() is valid JSON"
jenkins-bot [Fri, 9 Sep 2016 08:29:15 +0000 (08:29 +0000)]
Merge "JsonContentHandler: Make sure makeEmptyContent() is valid JSON"

7 years agoMerge "Cleanup and re-indent some WANObjectCache docs"
jenkins-bot [Fri, 9 Sep 2016 08:17:28 +0000 (08:17 +0000)]
Merge "Cleanup and re-indent some WANObjectCache docs"

7 years agoobjectcache: add "staleTTL" option to WANObjectCache::set()
Aaron Schulz [Fri, 9 Sep 2016 08:05:55 +0000 (01:05 -0700)]
objectcache: add "staleTTL" option to WANObjectCache::set()

Change-Id: Ib9386a8ad4ab98d07d0a3784e3afffeeca9bbd6e

7 years agoMerge "Allow --profile to be used in phpunit.php"
jenkins-bot [Fri, 9 Sep 2016 07:58:55 +0000 (07:58 +0000)]
Merge "Allow --profile to be used in phpunit.php"

7 years agoCleanup and re-indent some WANObjectCache docs
Aaron Schulz [Fri, 9 Sep 2016 07:57:57 +0000 (00:57 -0700)]
Cleanup and re-indent some WANObjectCache docs

Change-Id: Ibf7092297ce53fd21e478a6f87a16f9b4373ad85

7 years agoMerge "Split up testHelpers.inc, break off fuzz testing"
jenkins-bot [Fri, 9 Sep 2016 07:56:46 +0000 (07:56 +0000)]
Merge "Split up testHelpers.inc, break off fuzz testing"

7 years agoMerge "WebRequest: Add more unit tests"
jenkins-bot [Fri, 9 Sep 2016 06:54:45 +0000 (06:54 +0000)]
Merge "WebRequest: Add more unit tests"

7 years agoLinkBatch: Set visibility and document constructor
Kunal Mehta [Fri, 9 Sep 2016 05:02:39 +0000 (22:02 -0700)]
LinkBatch: Set visibility and document constructor

Change-Id: I9d8edeb214b9d7507826004e470dcb5c1ef015f6

7 years agoTitle: Document that Title::compare() can be used for LinkTargets
Kunal Mehta [Fri, 9 Sep 2016 04:58:55 +0000 (21:58 -0700)]
Title: Document that Title::compare() can be used for LinkTargets

It only depends upon functions that are all in the LinkTarget interface.

Change-Id: I95e598ea6014ced8f1b947c283dd0b542756b8e2

7 years agoWebRequest: Add more unit tests
Timo Tijhof [Fri, 9 Sep 2016 04:58:09 +0000 (21:58 -0700)]
WebRequest: Add more unit tests

* Complete detectServer() coverage,
  test $wgAssumeProxiesUseDefaultProtocolPorts.
* Complete getAcceptLang() coverage.
* Add tests for getGPCVal() normalisation.
* Add tests for other getter methods.

Also:

* Ignore __construct() coverage as it only sets up properties from
  global state. The use of those properties are covered.

* Make normalizeUnicode() visibility explicit.

Change-Id: I6504136e6df47e504bc2e0e91fedddd2625f19d9

7 years agoMerge "rollback: Log content model changes"
jenkins-bot [Fri, 9 Sep 2016 04:55:52 +0000 (04:55 +0000)]
Merge "rollback: Log content model changes"

7 years agoMerge "InfoAction: Add a link to Special:ChangeContentModel if allowed"
jenkins-bot [Fri, 9 Sep 2016 04:16:05 +0000 (04:16 +0000)]
Merge "InfoAction: Add a link to Special:ChangeContentModel if allowed"

7 years agorollback: Log content model changes
Kunal Mehta [Fri, 9 Sep 2016 04:09:24 +0000 (21:09 -0700)]
rollback: Log content model changes

If the content model changes during a rollback, make sure it is logged
to Special:Log/contentmodel.

Change-Id: Icd9a2b0221468936e186178ef09141c09e053cbb

7 years agoMerge "Only apply DB_MASTER fallback in Revision::fetchText() if READ_LATEST"
jenkins-bot [Fri, 9 Sep 2016 03:47:43 +0000 (03:47 +0000)]
Merge "Only apply DB_MASTER fallback in Revision::fetchText() if READ_LATEST"

7 years agoMerge "API: When undoing an edit, allow overriding content model."
jenkins-bot [Fri, 9 Sep 2016 03:30:31 +0000 (03:30 +0000)]
Merge "API: When undoing an edit, allow overriding content model."

7 years agoMerge "Allow undoing edits that change content model if top"
jenkins-bot [Fri, 9 Sep 2016 03:27:42 +0000 (03:27 +0000)]
Merge "Allow undoing edits that change content model if top"

7 years agoAPI: When undoing an edit, allow overriding content model.
Brian Wolff [Thu, 8 Sep 2016 23:43:36 +0000 (23:43 +0000)]
API: When undoing an edit, allow overriding content model.

This brings the API in line with web UI changes from Ic528f65d.

Bug: T145044
Change-Id: Ib97eef38d228c4da4b062ee96ddbbbb926ee665b

7 years agoAllow undoing edits that change content model if top
Brian Wolff [Thu, 8 Sep 2016 22:39:03 +0000 (22:39 +0000)]
Allow undoing edits that change content model if top

This allows people to revert content model changes
using the undo button, provided that we are undoing
the topmost edit (Otherwise it may get confusing
if you try to undo an edit in the middle of the
history that changes content model).

Bug: T145044
Change-Id: Ic528f65d0dc581c4e241a22f19c512e02aeaa9e7

7 years agoMerge "Make sure the lock in JobRunner::commitMasterChanges() releases"
jenkins-bot [Fri, 9 Sep 2016 03:04:59 +0000 (03:04 +0000)]
Merge "Make sure the lock in JobRunner::commitMasterChanges() releases"

7 years agoMerge "Switch some callers to WaitConditionLoop"
jenkins-bot [Fri, 9 Sep 2016 02:57:13 +0000 (02:57 +0000)]
Merge "Switch some callers to WaitConditionLoop"

7 years agoMake $wgRevisionCacheExpiry default to one week
Aaron Schulz [Wed, 7 Sep 2016 21:19:31 +0000 (14:19 -0700)]
Make $wgRevisionCacheExpiry default to one week

* If CACHE_DB is used, it will not use the cache however.
* If persistent cache is disabled, at least maintain the
  process caching.

Change-Id: I23b455ef46f27c313bb9573f69723b1436b2d584

7 years agoMerge "FauxRequest: Add unit tests to expand code coverage"
jenkins-bot [Fri, 9 Sep 2016 02:47:05 +0000 (02:47 +0000)]
Merge "FauxRequest: Add unit tests to expand code coverage"

7 years agoFauxRequest: Add unit tests to expand code coverage
Timo Tijhof [Fri, 9 Sep 2016 02:37:37 +0000 (19:37 -0700)]
FauxRequest: Add unit tests to expand code coverage

* Remove @covers for methods that don't exist (parent class).
* Fix coverage for initHeaders() and setHeaders().
* Add tests and coverage for all other methods.

Change-Id: Id9b6de31843d2e87c54f485beb4fbcbe6f4bf8f6

7 years agoSwitch some callers to WaitConditionLoop
Aaron Schulz [Thu, 8 Sep 2016 07:12:56 +0000 (00:12 -0700)]
Switch some callers to WaitConditionLoop

Also fixed up backwards documentation

Change-Id: I00c36aa751a79ca86a754e049a6da78cbb417b81

7 years agoMerge "Preload ResourceLoaderWikiModule::getTitleInfo in OutputPage"
jenkins-bot [Fri, 9 Sep 2016 01:11:07 +0000 (01:11 +0000)]
Merge "Preload ResourceLoaderWikiModule::getTitleInfo in OutputPage"

7 years agoMerge "Avoid user autocreation race condition caused by repeatable read"
jenkins-bot [Fri, 9 Sep 2016 00:28:52 +0000 (00:28 +0000)]
Merge "Avoid user autocreation race condition caused by repeatable read"

7 years agoInfoAction: Add a link to Special:ChangeContentModel if allowed
Kunal Mehta [Fri, 9 Sep 2016 00:08:21 +0000 (17:08 -0700)]
InfoAction: Add a link to Special:ChangeContentModel if allowed

If the user is allowed to change the content model of the page,
then add a link to it on ?action=info, next to the localized content
model name.

Change-Id: I084e8f390f90d29ed2e2d0f8ab43bcdfe8538ad1

7 years agoAvoid user autocreation race condition caused by repeatable read
Gergő Tisza [Thu, 8 Sep 2016 22:40:20 +0000 (22:40 +0000)]
Avoid user autocreation race condition caused by repeatable read

AuthManager tries to check whether the user already exists if
User::addToDatabase fails in autocreation, but since the same DB row
was already checked a few lines earlier and this method is typically
wrapped in an implicit transaction, it will just re-read the same
snapshot and not do anything useful. addToDatabase already has
a check for that so let's rely on that instead.

Bug: T145131
Change-Id: I94a5e8b851dcf994f5f9e773edf4e9153a4a3535

7 years agoPreload ResourceLoaderWikiModule::getTitleInfo in OutputPage
Aaron Schulz [Thu, 8 Sep 2016 08:38:26 +0000 (01:38 -0700)]
Preload ResourceLoaderWikiModule::getTitleInfo in OutputPage

This avoids a separate query for each module.

Bug: T46362
Change-Id: Ie109a8776cbdcd5928cbb59351f2cf94088c0c95

7 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Thu, 8 Sep 2016 21:10:04 +0000 (23:10 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I11dbcc26b7ee18146c907c309bbc67ba4ccc9339

7 years agoMerge "objectcache: expose "minTime" in WAN cache and call it "minAsOf" instead"
jenkins-bot [Thu, 8 Sep 2016 20:52:35 +0000 (20:52 +0000)]
Merge "objectcache: expose "minTime" in WAN cache and call it "minAsOf" instead"

7 years agoobjectcache: expose "minTime" in WAN cache and call it "minAsOf" instead
Aaron Schulz [Thu, 8 Sep 2016 20:42:17 +0000 (13:42 -0700)]
objectcache: expose "minTime" in WAN cache and call it "minAsOf" instead

Change-Id: Iabb639dddb9458d961dbbaee6a0dfb2323c2739a

7 years agoMerge "Fix IDEA warnings in CategoryMembershipChangeJob"
jenkins-bot [Thu, 8 Sep 2016 20:38:55 +0000 (20:38 +0000)]
Merge "Fix IDEA warnings in CategoryMembershipChangeJob"

7 years agoJsonContentHandler: Make sure makeEmptyContent() is valid JSON
Kunal Mehta [Thu, 8 Sep 2016 06:18:47 +0000 (23:18 -0700)]
JsonContentHandler: Make sure makeEmptyContent() is valid JSON

The default TextContentHandler::makeEmptyContent() implementation
is an empty string, which is not valid JSON.

Change-Id: I8bc6ec647c5e8cd01c5cd63031525619c4ef44d0

7 years agoobjectcache: pass in the $oldValue as-of time in getWithSetCallback()
Aaron Schulz [Thu, 8 Sep 2016 18:34:39 +0000 (11:34 -0700)]
objectcache: pass in the $oldValue as-of time in getWithSetCallback()

This lets callers use adaptive TTLs on the near-expiration
preemptive refreshes if the new and current values match,
using the as-of time as $mtime.

Change-Id: Ie541c35f890c9f789d1accf9f2a43506daaf31f0

7 years agoHide signup/login/logout links when they would not work
Gergő Tisza [Wed, 7 Sep 2016 05:50:35 +0000 (05:50 +0000)]
Hide signup/login/logout links when they would not work

Immutable session providers do not support login and logout;
these pages would just show an error when such a session provider
is handling the authentication of the request. Depending on what
authentication providers are configured, the wiki might not
support account creation. Showing the links is unhelpful if
they would just show an obscure error message.

(OTOH don't try to hide the link when the reason it is not
usable depends on the user; specifically, don't check
AuthManager::checkAccountCreatePermissions. An error message
is more informative in that case than a missing link.)

Also improve how the affected special pages behave if the user
manages to get there anyway.

Change-Id: Ic0ad237259797a8d471bdabc57a4bd0ffe8fa33b

7 years agoMerge "LinkFilter: Fix return types in phpdoc"
jenkins-bot [Thu, 8 Sep 2016 15:32:11 +0000 (15:32 +0000)]
Merge "LinkFilter: Fix return types in phpdoc"

7 years agoFix doc typo in InterwikiLookup
Leszek Manicki [Thu, 8 Sep 2016 13:11:55 +0000 (15:11 +0200)]
Fix doc typo in InterwikiLookup

Change-Id: I2a547a005955cb9f596ff6927feb7df3d5d91872

7 years agoFix IDEA warnings in CategoryMembershipChangeJob
Aaron Schulz [Thu, 8 Sep 2016 13:03:22 +0000 (06:03 -0700)]
Fix IDEA warnings in CategoryMembershipChangeJob

Change-Id: I0ee952c59cccf00167d468adb49d4bf811a80dc9

7 years agoMerge "database: rename clearSnapshot() => flushSnapshot()"
jenkins-bot [Thu, 8 Sep 2016 12:36:35 +0000 (12:36 +0000)]
Merge "database: rename clearSnapshot() => flushSnapshot()"

7 years agodatabase: rename clearSnapshot() => flushSnapshot()
Aaron Schulz [Thu, 8 Sep 2016 11:28:52 +0000 (04:28 -0700)]
database: rename clearSnapshot() => flushSnapshot()

* This is more consistent with the name flushReplicaSnapshots().
* Also add it to IDatabase, which defines the modern OLTP methods
  of DatabaseBase. This methods is useful for callers that get
  locks or wait for a replica DB to catch up before querying it.

Change-Id: Ia31e480bb9ccf461bf05ede4278920918eec4f16

7 years agoMerge "ContentHandler: Remove entirely-unused mModelName property"
jenkins-bot [Thu, 8 Sep 2016 11:10:01 +0000 (11:10 +0000)]
Merge "ContentHandler: Remove entirely-unused mModelName property"

7 years agoMake sure the lock in JobRunner::commitMasterChanges() releases
Aaron Schulz [Thu, 8 Sep 2016 09:19:32 +0000 (02:19 -0700)]
Make sure the lock in JobRunner::commitMasterChanges() releases

Used a ScopedCallback in case of exception to avoid queue backup

Change-Id: I58a5f152a54ed9a0d5544014788792bd62afbf4a

7 years agoMerge "Run tests from MediaWiki-Vagrant virtual machine headlessly"
jenkins-bot [Thu, 8 Sep 2016 09:10:45 +0000 (09:10 +0000)]
Merge "Run tests from MediaWiki-Vagrant virtual machine headlessly"

7 years agoMerge "Rollback: Change @since 1.27 to @since 1.28"
jenkins-bot [Thu, 8 Sep 2016 07:02:13 +0000 (07:02 +0000)]
Merge "Rollback: Change @since 1.27 to @since 1.28"

7 years agoContentHandler: Remove entirely-unused mModelName property
Kunal Mehta [Thu, 8 Sep 2016 06:10:12 +0000 (23:10 -0700)]
ContentHandler: Remove entirely-unused mModelName property

This property isn't documented anywhere nor used anywhere.

Change-Id: I37b20260c6abbec49364b31183dd2337be44846b

7 years agoMerge "Don't throw exceptions in ContentHandler::getUndoContent()"
jenkins-bot [Thu, 8 Sep 2016 05:07:13 +0000 (05:07 +0000)]
Merge "Don't throw exceptions in ContentHandler::getUndoContent()"

7 years agoMerge "Run database-using tests in MySQL STRICT mode"
jenkins-bot [Thu, 8 Sep 2016 04:20:45 +0000 (04:20 +0000)]
Merge "Run database-using tests in MySQL STRICT mode"

7 years agoRollback: Change @since 1.27 to @since 1.28
Fomafix [Thu, 8 Sep 2016 04:13:09 +0000 (06:13 +0200)]
Rollback: Change @since 1.27 to @since 1.28

9af38c04 is not included in REL1.27.

Follows-up to 9af38c04

Change-Id: I377028aec91d15b63257baf522b5aa2dbd12d43b

7 years agoMerge "resourceloader: Preload WikiModule::getTitleInfo() in batches"
jenkins-bot [Thu, 8 Sep 2016 03:53:04 +0000 (03:53 +0000)]
Merge "resourceloader: Preload WikiModule::getTitleInfo() in batches"

7 years agoDon't throw exceptions in ContentHandler::getUndoContent()
Kunal Mehta [Thu, 8 Sep 2016 03:52:19 +0000 (20:52 -0700)]
Don't throw exceptions in ContentHandler::getUndoContent()

The method is not documented to throw any exceptions, and already
returns false on failure, and it can be seen as a failure case when the
content models are not the same.

Bug: T145044
Change-Id: I0394d19cd65f9dd3ee350d2cde95afb11ab9e7f4

7 years agoOnly apply DB_MASTER fallback in Revision::fetchText() if READ_LATEST
Aaron Schulz [Wed, 7 Sep 2016 19:42:03 +0000 (12:42 -0700)]
Only apply DB_MASTER fallback in Revision::fetchText() if READ_LATEST

Add support to DBAccessObjectUtils for fallback logic to make
this simple for other callers too.

Change-Id: I58ab7bd7d31a481f9dc9a773392ea90feb1ebeac

7 years agoMerge "resourceloader: Simplify WikiModule::getTitleInfo() DB query"
jenkins-bot [Thu, 8 Sep 2016 03:42:53 +0000 (03:42 +0000)]
Merge "resourceloader: Simplify WikiModule::getTitleInfo() DB query"

7 years agoresourceloader: Preload WikiModule::getTitleInfo() in batches
Timo Tijhof [Thu, 8 Sep 2016 03:26:48 +0000 (20:26 -0700)]
resourceloader: Preload WikiModule::getTitleInfo() in batches

Test plan:
* Request load.php?modules=startup&only=scripts
* Debug log receives 1 entry in the 'queries' channel from
  ResourceLoaderWikiModule, and it comes from preloadTitleInfo.

Bug: T46362
Change-Id: I82e215745af6b8446cd69282b2c943afbbd45065

7 years agoresourceloader: Simplify WikiModule::getTitleInfo() DB query
Timo Tijhof [Thu, 8 Sep 2016 02:24:49 +0000 (19:24 -0700)]
resourceloader: Simplify WikiModule::getTitleInfo() DB query

While rev_sha1 was preferred to rev_id (page_latest) to allow
client-cache to be re-used in case of a bad change and revert,
this is no longer possible since we recently added support for
explicit purging by considering page_touched.

As such, use of rev_sha1 is no longer useful.

Change-Id: Iddb65305ca4655098fdea9fcf736fd4046035dd7

7 years agoAdd rate limits for changing a page's content model
Kunal Mehta [Thu, 8 Sep 2016 01:38:19 +0000 (18:38 -0700)]
Add rate limits for changing a page's content model

The defaults are set to the same value as page moves.

Change-Id: I72d6c35ecda475101c1c909715e4ba693dd214f6

7 years agoobjectcache: Avoid doxygen misformatting for pcGroup comments
Aaron Schulz [Thu, 8 Sep 2016 00:55:30 +0000 (17:55 -0700)]
objectcache: Avoid doxygen misformatting for pcGroup comments

Change-Id: I970bc9ccb04b046c563a357d87f814da652e23d2

7 years agoMerge "objectcache: add "pcGroup" option to WANObjectCache::getWithSetCallback()"
jenkins-bot [Thu, 8 Sep 2016 00:25:27 +0000 (00:25 +0000)]
Merge "objectcache: add "pcGroup" option to WANObjectCache::getWithSetCallback()"

7 years agoobjectcache: add "pcGroup" option to WANObjectCache::getWithSetCallback()
Aaron Schulz [Wed, 7 Sep 2016 22:36:14 +0000 (15:36 -0700)]
objectcache: add "pcGroup" option to WANObjectCache::getWithSetCallback()

This lets callers have their own process cache but keep it
managed in a central location, making it easier to reset
when DB transaction snapshot are flushed or when unit tests
want to clear caches between runs.

Use this to replace the Revision text process cache.

Change-Id: Ic61ee9140d4ce9836cc4650adb5bb75a291fea18

7 years agoAllow --profile to be used in phpunit.php
Tim Starling [Wed, 31 Aug 2016 02:53:21 +0000 (12:53 +1000)]
Allow --profile to be used in phpunit.php

This requires running PHPUnit from within execute() -- we're calling a
function so it doesn't benefit from being in global scope.

Change-Id: I4b6a3613bc89047a9f32505afabaff98b3655e1a

7 years agoSplit up testHelpers.inc, break off fuzz testing
Tim Starling [Mon, 29 Aug 2016 22:27:54 +0000 (08:27 +1000)]
Split up testHelpers.inc, break off fuzz testing

* Split up testHelpers.inc into one class per file, with the file named
  after the class per the usual convention. Put them in tests/parser
  since they are all parser-related, even though a couple are reused by
  other unit tests.
* Also rename parserTest.inc and parserTestsParserHook.php to follow the
  usual convention, and split off ParserTestResultNormalizer
* Move fuzz testing out to its own maintenance script. It's really not
  helpful to have fuzz testing, which is designed to run forever,
  exposed as a PHPUnit test.
* Increased fuzz test memory limit, and increased the memory headroom for
  getMemoryBreakdown(), since HHVM's ReflectionClass has an internal
  cache which uses quite a lot of memory.
* Temporarily switched a couple of ParserTest methods from private to
  public to support fuzz testing from a separate class -- I plan on
  replacing this interface in a subsequent commit.

Change-Id: Ib1a07e109ec1005bff2751b78eb4de35f2dfc472