lhc/web/wiklou.git
4 years agoMerge "Migrate remaining usages of Title::userCan() to PermissionManager"
jenkins-bot [Fri, 14 Jun 2019 11:19:47 +0000 (11:19 +0000)]
Merge "Migrate remaining usages of Title::userCan() to PermissionManager"

4 years agoMerge "Defines: Drop DB_SLAVE, deprecated since 1.28"
jenkins-bot [Fri, 14 Jun 2019 11:06:07 +0000 (11:06 +0000)]
Merge "Defines: Drop DB_SLAVE, deprecated since 1.28"

4 years agoDefines: Drop DB_SLAVE, deprecated since 1.28
James D. Forrester [Tue, 3 Jul 2018 21:26:43 +0000 (14:26 -0700)]
Defines: Drop DB_SLAVE, deprecated since 1.28

Change-Id: I9b48524bfa071c21e03c50e9e8231e4661917c78

4 years agoREST: Rename attributes to path params
Tim Starling [Mon, 10 Jun 2019 21:32:51 +0000 (07:32 +1000)]
REST: Rename attributes to path params

Change-Id: I1cd7297715bf0f9902949a5117ea7ab94b689a37

4 years agoREST: Testable EntryPoint
Tim Starling [Tue, 4 Jun 2019 23:59:57 +0000 (09:59 +1000)]
REST: Testable EntryPoint

* Split EntryPoint into a static main() and a non-static execute()
* Add tests for execute()

Change-Id: I025356b04ddc5a16494f98c446d785d6bb05ab10

4 years agoREST: HeaderContainer should start empty not null
Tim Starling [Mon, 10 Jun 2019 21:01:39 +0000 (07:01 +1000)]
REST: HeaderContainer should start empty not null

Change-Id: I30b68862307f2b44e4f5708c06464e0a218c1ed5

4 years agoStringStream and PathMatcher tests
Tim Starling [Mon, 3 Jun 2019 06:08:29 +0000 (16:08 +1000)]
StringStream and PathMatcher tests

Change-Id: Ic4c6e15ef9a107608fe8e72d469987ccce21f98f

4 years agoFix HHVM StringStream test errors
Tim Starling [Fri, 14 Jun 2019 07:00:11 +0000 (17:00 +1000)]
Fix HHVM StringStream test errors

Change-Id: I3eebd14db7157bb423ee88af7b49d92f628bc771

4 years agoMerge "Fix "succesful" typo"
jenkins-bot [Fri, 14 Jun 2019 00:54:19 +0000 (00:54 +0000)]
Merge "Fix "succesful" typo"

4 years agoMerge "StringStream::copyToStream() should adjust the offset"
jenkins-bot [Fri, 14 Jun 2019 00:18:31 +0000 (00:18 +0000)]
Merge "StringStream::copyToStream() should adjust the offset"

4 years agoMerge "REST: tests for HelloHandler and HeaderContainer"
jenkins-bot [Fri, 14 Jun 2019 00:18:22 +0000 (00:18 +0000)]
Merge "REST: tests for HelloHandler and HeaderContainer"

4 years agoMerge "REST: Implement 405 responses"
jenkins-bot [Fri, 14 Jun 2019 00:18:15 +0000 (00:18 +0000)]
Merge "REST: Implement 405 responses"

4 years agoFix "succesful" typo
petarpetkovic [Fri, 14 Jun 2019 00:11:03 +0000 (03:11 +0300)]
Fix "succesful" typo

Change-Id: I1f49ce9ce104263adc8763947dbd30634f18697d

4 years agoMerge "build: Add missing dashes in .travis.yml (restore PHP 7.1/7.2 tests)"
jenkins-bot [Fri, 14 Jun 2019 00:09:02 +0000 (00:09 +0000)]
Merge "build: Add missing dashes in .travis.yml (restore PHP 7.1/7.2 tests)"

4 years agoMerge "Fix doc type of Installer::addInstallStep"
jenkins-bot [Fri, 14 Jun 2019 00:08:43 +0000 (00:08 +0000)]
Merge "Fix doc type of Installer::addInstallStep"

4 years agoMerge "Clarify MediaWikiTestCase::getSchemaOverrides()"
jenkins-bot [Fri, 14 Jun 2019 00:06:06 +0000 (00:06 +0000)]
Merge "Clarify MediaWikiTestCase::getSchemaOverrides()"

4 years agoMerge "Storage: Type against ILBFactory and ILoadBalancer in storage classes"
jenkins-bot [Fri, 14 Jun 2019 00:05:03 +0000 (00:05 +0000)]
Merge "Storage: Type against ILBFactory and ILoadBalancer in storage classes"

4 years agoMerge "libs: Remove unused deprecated BufferingStatsdDataFactory::getBuffer()"
jenkins-bot [Thu, 13 Jun 2019 23:52:27 +0000 (23:52 +0000)]
Merge "libs: Remove unused deprecated BufferingStatsdDataFactory::getBuffer()"

4 years agoMerge "SpecialEmailUser: Remove validate/get target without sender specified"
jenkins-bot [Thu, 13 Jun 2019 23:52:21 +0000 (23:52 +0000)]
Merge "SpecialEmailUser: Remove validate/get target without sender specified"

4 years agoMerge "Revert "Separate MediaWiki unit and integration tests""
jenkins-bot [Thu, 13 Jun 2019 23:28:13 +0000 (23:28 +0000)]
Merge "Revert "Separate MediaWiki unit and integration tests""

4 years agoRevert "Separate MediaWiki unit and integration tests"
Legoktm [Thu, 13 Jun 2019 23:00:08 +0000 (23:00 +0000)]
Revert "Separate MediaWiki unit and integration tests"

This reverts commit 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9.

Reason for revert: Broke postgres tests.

Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1

4 years agobuild: Add missing dashes in .travis.yml (restore PHP 7.1/7.2 tests)
Timo Tijhof [Thu, 13 Jun 2019 22:21:25 +0000 (23:21 +0100)]
build: Add missing dashes in .travis.yml (restore PHP 7.1/7.2 tests)

Follows-up f638c599d5, in which I accidentally removed the leading
dashes from the entries in the 'include' array.

Apparently when you do that, it just assumes you intended to
have a dash in front of the first line and create a single-item
object in which you have the same key four times, where the last
one wins. Thus, testing only 1 variant: php 7.0.

Change-Id: I3fd77749017d15cc60daf9a531417b55c604e7ff

4 years agoMerge "Expand ResponseFactory"
jenkins-bot [Thu, 13 Jun 2019 22:18:28 +0000 (22:18 +0000)]
Merge "Expand ResponseFactory"

4 years agoMerge "REST API initial commit"
jenkins-bot [Thu, 13 Jun 2019 22:18:21 +0000 (22:18 +0000)]
Merge "REST API initial commit"

4 years agolibs: Remove unused deprecated BufferingStatsdDataFactory::getBuffer()
Derick Alangi [Thu, 23 May 2019 21:12:26 +0000 (22:12 +0100)]
libs: Remove unused deprecated BufferingStatsdDataFactory::getBuffer()

Usage
=====

https://codesearch.wmflabs.org/search/?q=%5CbgetBuffer%5Cb&i=nope&files=&repos=

Bug: T220656
Change-Id: I3d9637e1802e0d34698940f400c628f29f0aab3b

4 years agoSpecialEmailUser: Remove validate/get target without sender specified
Derick Alangi [Tue, 14 May 2019 11:14:07 +0000 (12:14 +0100)]
SpecialEmailUser: Remove validate/get target without sender specified

This was deprecated in 1.30 and per usage below, these has been cleaned
up. Passing "null" is deprecated and no longer used anywhere. All usage
now pass a user object that is the sender.

Usage
=====

* validateTarget():
https://codesearch.wmflabs.org/search/?q=%5CbvalidateTarget%5Cb&i=nope&files=&repos=

* getTarget():
https://codesearch.wmflabs.org/search/?q=%5Cb(-%3E%7C%3A%3A)getTarget%5Cb&i=nope&files=&repos=

Change-Id: I22ed2bc42216712602f8b4685035c3396d3d1e5c

4 years agoStorage: Type against ILBFactory and ILoadBalancer in storage classes
Umherirrender [Fri, 7 Jun 2019 14:22:48 +0000 (16:22 +0200)]
Storage: Type against ILBFactory and ILoadBalancer in storage classes

Instead of the LBFactory/LoadBalancer implementations.

Change-Id: Ia58d9056bd60f3f094fbb16f7b9afa64e11143c8

4 years agoMerge "Separate MediaWiki unit and integration tests"
Jforrester [Thu, 13 Jun 2019 22:06:10 +0000 (22:06 +0000)]
Merge "Separate MediaWiki unit and integration tests"

4 years agobuild: Remove dbtype=postgres from Travis CI matrix
Timo Tijhof [Thu, 13 Jun 2019 21:07:20 +0000 (22:07 +0100)]
build: Remove dbtype=postgres from Travis CI matrix

This has since been added to  WMF CI (and voting).

What remains is just secondary confirmation that the tests can
all pass a third-party system (e.g. not the WMF-specific Linux/Docker
environment), for supported PHP versions.

Change-Id: Ic257a34630c61d5328afeaa6dc5685581e03a528

4 years agoSeparate MediaWiki unit and integration tests
Máté Szabó [Sat, 1 Jun 2019 14:10:15 +0000 (16:10 +0200)]
Separate MediaWiki unit and integration tests

This changeset implements T89432 and related tickets and is based on exploration
done at the Prague Hackathon. The goal is to identify tests in MediaWiki core
that can be run without having to install & configure MediaWiki and its dependencies,
and provide a way to execute these tests via the standard phpunit entry point,
allowing for faster development and integration with existing tooling like IDEs.

The initial set of tests that met these criteria were identified using the work Amir did in
I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory
under phpunit/ and organized into a separate test suite. The environment for this suite
is set up via a PHPUnit bootstrap file without a custom entry point.

You can execute these tests by running:
$ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml

Bug: T89432
Bug: T87781
Bug: T84948
Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d

4 years agoMerge "rdbms: avoid LoadBalancer::getConnection waste when using $groups"
jenkins-bot [Thu, 13 Jun 2019 20:20:50 +0000 (20:20 +0000)]
Merge "rdbms: avoid LoadBalancer::getConnection waste when using $groups"

4 years agoLocalisation updates from https://translatewiki.net.
Translation updater bot [Thu, 13 Jun 2019 20:08:04 +0000 (22:08 +0200)]
Localisation updates from https://translatewiki.net.

Change-Id: I2557496565cbdfee6bba829b3d2fdd36875aa5f7

4 years agoMerge "resourceloader: Deprecate ResourceLoaderContext::getConfig and ::getLogger"
jenkins-bot [Thu, 13 Jun 2019 19:41:01 +0000 (19:41 +0000)]
Merge "resourceloader: Deprecate ResourceLoaderContext::getConfig and ::getLogger"

4 years agoMerge "resourceloader: Change cache keys to use first segment for grouping by purpose"
jenkins-bot [Thu, 13 Jun 2019 19:33:07 +0000 (19:33 +0000)]
Merge "resourceloader: Change cache keys to use first segment for grouping by purpose"

4 years agordbms: avoid LoadBalancer::getConnection waste when using $groups
Aaron Schulz [Wed, 8 May 2019 19:18:01 +0000 (12:18 -0700)]
rdbms: avoid LoadBalancer::getConnection waste when using $groups

Add a "readIndexByGroup" field that does the same thing that the
generic read index does except for query grouped connections.

Also remove some pointless checks at the end of getReaderIndex().

Change-Id: I3bd6295be4355ee930960f89ccb07811dd8c5545

4 years agoMerge "PHPDoc: Fix non-carnonical order of elements in phpdoc"
jenkins-bot [Thu, 13 Jun 2019 18:40:38 +0000 (18:40 +0000)]
Merge "PHPDoc: Fix non-carnonical order of elements in phpdoc"

4 years agoexternalstore: Fix insert*() return docs and remove redundant checks
Daimona Eaytoy [Mon, 7 Jan 2019 10:18:39 +0000 (11:18 +0100)]
externalstore: Fix insert*() return docs and remove redundant checks

ExternalStorage::insertWithFallback is reported to return false on
failure, but it doesn't. It has a single exit point, and return value is
checked with strlen(), so actually it can only return the URL or throw.
Thus, update any related doc and remove a redundant check from code
calling insertToDefault.

Change-Id: Ic95c3aed19118b987aef105f8077d55558f39127

4 years agoMerge "objectcache: add object segmentation support to BagOStuff"
jenkins-bot [Thu, 13 Jun 2019 18:19:17 +0000 (18:19 +0000)]
Merge "objectcache: add object segmentation support to BagOStuff"

4 years agoresourceloader: Change cache keys to use first segment for grouping by purpose
Timo Tijhof [Tue, 28 May 2019 18:24:31 +0000 (19:24 +0100)]
resourceloader: Change cache keys to use first segment for grouping by purpose

Remove use of a complete "namespace" for grouping and instead use dashes
within the first key segment for that.

This way, we can leverage the various features WANObjectCache provides
for statistics relating to a particular kind of thing being cached.

These statistics are currently combined for all of resourceloader,
which isn't useful. Mildly related to T223647.

Change-Id: I5df69e46ac436d04e765726a36fc3eb70697a7ed

4 years agoMerge "rdbms: reorganize Database fields and constants"
jenkins-bot [Thu, 13 Jun 2019 17:57:41 +0000 (17:57 +0000)]
Merge "rdbms: reorganize Database fields and constants"

4 years agoMerge "rdbms: implement strictor ownership of LoadBalancer by LBFactory"
jenkins-bot [Thu, 13 Jun 2019 17:50:00 +0000 (17:50 +0000)]
Merge "rdbms: implement strictor ownership of LoadBalancer by LBFactory"

4 years agordbms: reorganize Database fields and constants
Aaron Schulz [Thu, 13 Jun 2019 11:27:30 +0000 (12:27 +0100)]
rdbms: reorganize Database fields and constants

Move the constants to the bottom and make more of them private.
Place the configuration fields at the top of the list.
Also, move some related fields closer to each other.

In addition:
* Rename the named lock tracking variable to start with the
  prefix "session" for consistency.
* Remove unused $preparedArgs field.
* Rename $sessionVars and $rttEstimate fields.
* Use short field documentation syntax.
* Make transaction callback fields private.

Change-Id: I7d78be6744723f4d7bb32a75154564ee04eca0f6

4 years agoresourceloader: Deprecate ResourceLoaderContext::getConfig and ::getLogger
Timo Tijhof [Thu, 11 Apr 2019 22:22:08 +0000 (23:22 +0100)]
resourceloader: Deprecate ResourceLoaderContext::getConfig and ::getLogger

The methods existed for two use cases.

1. Inside ResourceLoaderContext, usage was removed with I4e4ee758cd22.
2. In Module class methods that get $context, already have their own
   Config and Logger instances injected from ResourceLoader::getModule(),
   which should be used instead.

Deprecating these opens the paths for making ResourceLoaderContext
a purer value object with no ResourceLoader, Config, or Logger objects
needing to be passed (in the future).

Bug: T32956
Change-Id: I74a9535918ea43b2c00073c5d4469f864d1eeb41

4 years agoresourceloader: Omit default 'lang' and 'skin' params from load.php urls
Fomafix [Mon, 10 Jun 2019 17:38:05 +0000 (19:38 +0200)]
resourceloader: Omit default 'lang' and 'skin' params from load.php urls

lang=qqx and skin=fallback are the default values.

This change removes the default values from the load request of the
html5shiv module.

Before this change
 <script src="/w/load.php?lang=qqx&amp;modules=html5shiv&amp;only=scripts&amp;skin=fallback&amp;sync=1"></script>
With this change
 <script src="/w/load.php?modules=html5shiv&amp;only=scripts&amp;sync=1"></script>

Change-Id: Ie384ce0f7ab1bd0b6c2d3f0ca4a990c3cf3a7f15

4 years agoselenium: Skip another flaky Rollback test
Timo Tijhof [Thu, 13 Jun 2019 17:22:11 +0000 (18:22 +0100)]
selenium: Skip another flaky Rollback test

Bug: T220479
Change-Id: Ie523e719f5c7df959ef63930edaff1a80e09ff04

4 years agoMerge "DevelopmentSettings: Remove redundant CacheType overrides"
jenkins-bot [Thu, 13 Jun 2019 14:52:07 +0000 (14:52 +0000)]
Merge "DevelopmentSettings: Remove redundant CacheType overrides"

4 years agoMerge "installer: Detect APC for MainCacheType in CLI installer"
jenkins-bot [Thu, 13 Jun 2019 14:50:02 +0000 (14:50 +0000)]
Merge "installer: Detect APC for MainCacheType in CLI installer"

4 years agoDevelopmentSettings: Remove redundant CacheType overrides
Timo Tijhof [Thu, 13 Jun 2019 01:08:53 +0000 (02:08 +0100)]
DevelopmentSettings: Remove redundant CacheType overrides

Follows-up 5a090c29822. This is no longer needed as of
7e0fb4fff6, which will add this to the generated LocalSettings.php
file automatically.

The installer now sets MainCacheType for CLI installs, the same
way as the web installer did already.

The secondary cache types have as default CACHE_ANYTHING (not
CACHE_NONE) and will automatically inherit from MainCacheType.

This commit unbreaks situations where developers have MainCache
set to something (e.g. Redis, or Memc) which after 5a090c29822
caused other types to go to APC instead of Memc.

Bug: T225496
Change-Id: Ib2824a6d316912daf09672de748726b91e4de449

4 years agoinstaller: Detect APC for MainCacheType in CLI installer
Timo Tijhof [Thu, 13 Jun 2019 14:06:43 +0000 (15:06 +0100)]
installer: Detect APC for MainCacheType in CLI installer

The web installer did this already, but with the CLI installer,
the generated LocalSettings.php always contained the following
hardcoded:

 $wgMainCacheType = CACHE_NONE;

Combined with the fact that in WMF CI, the generated local settings
is applied *after* the inclusion of Quibble settings and
DevelopmentSettings, meant that it was not possible to enable
object caching.

For now, make it match the behaviour of the web installer and thus
output $wgMainCacheType = CACHE_ACCELL if we detect a supported
implementation in the PHP runtime.

For later we should probably:

* Make this an option to install.php,
* or, change Quibble to append its overrides, instead of
  prepending. So that DevelopmentSettings actually after the
  generated LocalSettings.

Bug: T225496
Change-Id: I3f43cd054ce71d0f1b2395302e8ef9ee2f6b01c2

4 years agoMerge "Do move options checks before the move"
jenkins-bot [Thu, 13 Jun 2019 10:13:31 +0000 (10:13 +0000)]
Merge "Do move options checks before the move"

4 years agordbms: implement strictor ownership of LoadBalancer by LBFactory
Aaron Schulz [Sun, 9 Jun 2019 07:22:45 +0000 (08:22 +0100)]
rdbms: implement strictor ownership of LoadBalancer by LBFactory

Change-Id: Idafd2cf05e016a5f88b90e4c4c74f82c212d61c9

4 years agoMerge "Database: Recognize USE queries as non-write queries"
jenkins-bot [Wed, 12 Jun 2019 23:54:07 +0000 (23:54 +0000)]
Merge "Database: Recognize USE queries as non-write queries"

4 years agoDeleteLogFormatter: Handle missing ofield/nfield
Brad Jorsch [Mon, 3 Jun 2019 13:59:33 +0000 (09:59 -0400)]
DeleteLogFormatter: Handle missing ofield/nfield

ofield and nfield may be missing from old log entries. Take that into
account when processing.

Bug: T224815
Change-Id: I06dda3106bab9980f6fa7d515542e94a91c17f64

4 years agoDatabase: Recognize USE queries as non-write queries
Roan Kattouw [Wed, 12 Jun 2019 23:29:50 +0000 (16:29 -0700)]
Database: Recognize USE queries as non-write queries

This should unbreak Ie7341a0e6c41, which switched
DatabaseMysql::doSelectDomain() from using doQuery() to using
executeQuery() for its USE query, which means it no longer
bypasses the isWriteQuery() check. This caused every USE query on a
replica DB to fail, because it was considered a write query.

Bug: T225682
Bug: T212284
Change-Id: Iecb8b9f6e64d08df8c64b3133078b5324e654ed1
Follows-Up: Ie7341a0e6c4149fc375cc357877486efe9e56eb9

4 years agoMerge "Add CompositeBlock class for enforcing multiple blocks"
jenkins-bot [Wed, 12 Jun 2019 21:28:33 +0000 (21:28 +0000)]
Merge "Add CompositeBlock class for enforcing multiple blocks"

4 years agoMerge "rdbms: add Database::executeQuery() method for internal use"
jenkins-bot [Wed, 12 Jun 2019 19:58:18 +0000 (19:58 +0000)]
Merge "rdbms: add Database::executeQuery() method for internal use"

4 years agoPHPDoc: Fix non-carnonical order of elements in phpdoc
Derick Alangi [Wed, 12 Jun 2019 19:10:25 +0000 (20:10 +0100)]
PHPDoc: Fix non-carnonical order of elements in phpdoc

Change-Id: I21330e14629b5cd085f55c1b6c6232a4a6f4afcf

4 years agoFix doc type of Installer::addInstallStep
Umherirrender [Wed, 12 Jun 2019 18:41:13 +0000 (20:41 +0200)]
Fix doc type of Installer::addInstallStep

The argument $callback is not a callable
The callable is in $callback['callable'], so change the type to array

Change-Id: I9b990f2729874b2743cbcc501b97758da5bf8154

4 years agoAdd CompositeBlock class for enforcing multiple blocks
Thalia [Tue, 19 Mar 2019 18:56:10 +0000 (18:56 +0000)]
Add CompositeBlock class for enforcing multiple blocks

Create a CompositeBlock class which extends AbstractBlock and
adds the property $originalBlocks. This is for situations where
more than one block applies to a user/IP, and avoids the need
to choose just one of these blocks to enforce.

Behaviour of the resulting block is determined by combining the
strictest parameters of the original blocks.

Also add DatabaseBlock::newListFromTarget, which is similar to
DatabaseBlock::newFromTarget, but returns all relevant blocks,
rather than choosing the most specific one.

For tracking a CompositeBlock with a cookie, examine the
original blocks and only track the first trackable block that
is found.

Bug: T206163
Change-Id: I088401105ac8ceb2c6117c6d2fcdb277c754d882

4 years agoMerge "Remove unnecessary semi-colons"
Fomafix [Wed, 12 Jun 2019 18:05:55 +0000 (18:05 +0000)]
Merge "Remove unnecessary semi-colons"

4 years agoMerge "Fix and re-enable ApiQueryLanguageinfoTest"
jenkins-bot [Wed, 12 Jun 2019 16:28:33 +0000 (16:28 +0000)]
Merge "Fix and re-enable ApiQueryLanguageinfoTest"

4 years agoMerge "resourceloader: Convert test for FileModule versionHash to data provider"
jenkins-bot [Wed, 12 Jun 2019 16:18:10 +0000 (16:18 +0000)]
Merge "resourceloader: Convert test for FileModule versionHash to data provider"

4 years agoMerge "Set min-width on rcfilter dropdown"
jenkins-bot [Wed, 12 Jun 2019 15:44:39 +0000 (15:44 +0000)]
Merge "Set min-width on rcfilter dropdown"

4 years agoFix and re-enable ApiQueryLanguageinfoTest
Lucas Werkmeister [Fri, 7 Jun 2019 13:25:14 +0000 (15:25 +0200)]
Fix and re-enable ApiQueryLanguageinfoTest

Anomie discovered (T225244#5250241) that we need to clear the language
cache here; with that, the test should work again, so re-enable it.

Bug: T225244
Change-Id: I67e8446a4ff64d12ab3a3a52a432a728d4139a69

4 years agoRemoves updateIfHeightChanged override on rcfilters
Jan Drewniak [Wed, 12 Jun 2019 11:02:12 +0000 (13:02 +0200)]
Removes updateIfHeightChanged override on rcfilters

This override causes the rcfilter dropdown menu to be incorrectly
positioned when the height of the "tag box" changes,
i.e. when a tag is added and an additional row is created.

This override was originally added as part of T198399 in commit
a9fc286, but given bb15314 prevents the resize event from firing on
pageload, that change should mitigate the performance impact of
this function.

Bug: T225499
Change-Id: I4a296c7d3c277d5415144aee6434b63a5035d275

4 years agoresourceloader: Convert test for FileModule versionHash to data provider
Timo Tijhof [Wed, 12 Jun 2019 14:05:09 +0000 (15:05 +0100)]
resourceloader: Convert test for FileModule versionHash to data provider

In prep for the next commit.

Change-Id: If08c3d8b769b6ec03faf8ff24f216ce9f670f6ac

4 years agoRemove unnecessary semi-colons
Derick Alangi [Wed, 12 Jun 2019 13:35:59 +0000 (14:35 +0100)]
Remove unnecessary semi-colons

Change-Id: I9eb65bdfbd3aa581effc14ead801b9e89b0359c3

4 years agoDo move options checks before the move
Gergő Tisza [Wed, 12 Jun 2019 11:41:15 +0000 (13:41 +0200)]
Do move options checks before the move

This is both more correct conceptually (if the move-subpages
permission check depends on the page content, we want that to be
the content that is getting moved) and hopefully more robust
(whereas doing permission checks on a title just after having
moved it might run into issues with replication lag).

Also, permission checks can be expensive so skip the move-subpage
check when the user did not request moving subpages anyway. And
replace the deprecated method.

Bug: T225366
Change-Id: I9809b2a5bbae4006d5c5389dfd7c04f20f7da8fd

4 years agoSet min-width on rcfilter dropdown
Jan Drewniak [Wed, 12 Jun 2019 10:46:32 +0000 (12:46 +0200)]
Set min-width on rcfilter dropdown

Setting a min-width on the body of the rcfilter dropdown menu
prevents it from dropping to width=0 when the browser is
narrower than 650px.

Bug: T225499
Change-Id: I8e7281994af45a52b994fe277fc513db2ae2c4d6

4 years agoStringStream::copyToStream() should adjust the offset
Tim Starling [Mon, 3 Jun 2019 06:10:44 +0000 (16:10 +1000)]
StringStream::copyToStream() should adjust the offset

As Stream is assumed to do.

Change-Id: I25ed0da8e8ca1b4393f88e64ecf7b96484ce8118

4 years agoREST: tests for HelloHandler and HeaderContainer
Tim Starling [Fri, 31 May 2019 04:50:47 +0000 (14:50 +1000)]
REST: tests for HelloHandler and HeaderContainer

Change-Id: Ia214d4ad85bb2041e49b6cfe8278775387c30138

4 years agoREST: Implement 405 responses
Tim Starling [Fri, 31 May 2019 03:41:40 +0000 (13:41 +1000)]
REST: Implement 405 responses

Change-Id: I2a4676569a9903d12b7f5f731c5fd47ceafc3c6c

4 years agoExpand ResponseFactory
Tim Starling [Tue, 4 Jun 2019 05:52:19 +0000 (15:52 +1000)]
Expand ResponseFactory

* Factor out json_encode() call into ResponseFactory::encodeJson().
* Add createJson() and standardize on JSON for 4xx and 5xx responses
* Add methods for redirect generation, providing an HTML link in the
  body as recommended by RFC 7231

Most of the code was written by Gergő Tisza. The differences compared to
I747e34faecbcd are:

* Remove JsonResponse.
* Swap parameter order of createJson() reflecting the fact that the
  value is now usually provided.
* Remove unnecessary ResponseFactory::setStatus()
* Don't do ['code' => 'http500'] by default, use httpCode and httpReason
  to provide that information
* In createFromReturnValue(), don't wrap numerically-indexed arrays.
* Added tests.

Bug: T223240
Change-Id: Ie185b2bd43690633f1ccbe6328a0518e43a9f2f9

4 years agoREST API initial commit
Tim Starling [Thu, 9 May 2019 01:36:18 +0000 (11:36 +1000)]
REST API initial commit

Add some of the basic REST API class hierarchies:

* EntryPoint
* Router
* Request
* Response
* Handler

The actual entry point file rest.php has been moved to a separate
commit, so this is just an unused library and service.

Bug: T221177
Change-Id: Ifca6bcb8a304e8e8b7f52b79c607bdcebf805cd1

4 years agoMerge "ResourceLoaderOOUIIconPackModule: Always use MW core 'localBasePath'"
jenkins-bot [Tue, 11 Jun 2019 23:11:58 +0000 (23:11 +0000)]
Merge "ResourceLoaderOOUIIconPackModule: Always use MW core 'localBasePath'"

4 years agoResourceLoaderOOUIIconPackModule: Always use MW core 'localBasePath'
Bartosz Dziewoński [Tue, 11 Jun 2019 22:50:02 +0000 (00:50 +0200)]
ResourceLoaderOOUIIconPackModule: Always use MW core 'localBasePath'

Otherwise, extensions defining icon pack modules in extension.json
would need to specify "localBasePath": "../..", which is silly.

Follow-up to a8dae2212cc5e23e181023af2ba1891078b14355.

Change-Id: If8f02867955d649c809b6b41de0f77e594b633d6

4 years agoExempt structure tests from @covers checks
Gergő Tisza [Sat, 2 Mar 2019 03:06:54 +0000 (19:06 -0800)]
Exempt structure tests from @covers checks

@covers does not make any sense for structure tests, which either
do not cover any PHP lines (they test things like configuration or
messages), or cover lines which cannot be determined at the time
of writing the tests (e.g. they cover all classes implementing a
certain interface). Requiring @coversNothing to be manually added
for all of them is a waste of developer time.

tests/phpunit/suite.xml has forceCoversAnnotation=true so removing
the annotations will not change test coverage, these files will
still be skipped.

Change-Id: I27cb58e92341b9b1a76f109701f5bc843adbaa9b

4 years agoMerge "Inline trivial object creation helpers in tests"
jenkins-bot [Tue, 11 Jun 2019 20:55:44 +0000 (20:55 +0000)]
Merge "Inline trivial object creation helpers in tests"

4 years agoMerge "jquery.suggestions: Load initial suggestions only when focused"
jenkins-bot [Tue, 11 Jun 2019 20:22:38 +0000 (20:22 +0000)]
Merge "jquery.suggestions: Load initial suggestions only when focused"

4 years agoMerge "Installer: Update link to PHP intl away from old PECL package"
jenkins-bot [Tue, 11 Jun 2019 19:51:21 +0000 (19:51 +0000)]
Merge "Installer: Update link to PHP intl away from old PECL package"

4 years agoInstaller: Update link to PHP intl away from old PECL package
Karsten Hoffmeyer [Tue, 11 Jun 2019 19:24:16 +0000 (21:24 +0200)]
Installer: Update link to PHP intl away from old PECL package

PHP 5.5 was the last version supported by PECL intl package. Now the
PHP intl extension is used instead.

Bug: T225558
Change-Id: I68cb7a549c899e69da9a8cfea5a69b9acb41e8ae

4 years agomaintenance: Use addDescription() instead of accessing mDescription directly
Derick Alangi [Sat, 18 May 2019 13:13:46 +0000 (14:13 +0100)]
maintenance: Use addDescription() instead of accessing mDescription directly

Change-Id: I705a3fab4a6b151b81b45a3e2d7559f554986378

4 years agoAllow loading styles for arbitrary OOUI icon packs
Bartosz Dziewoński [Mon, 12 Feb 2018 19:41:44 +0000 (20:41 +0100)]
Allow loading styles for arbitrary OOUI icon packs

You can now create ResourceLoader modules for arbitrary sets of OOUI
icons. This is an alternative to I8af783666a2b23a938af93c1b56fee619219eaf5.

Update dependencies of OOUI's modules to use custom icon packs instead
of default icon packs.

Bug: T160690
Change-Id: Icf9560da79c91e56c7a3f4c0de01dd057f5aa00d

4 years agoMerge "resources: Remove unused jquery.effects.* modules"
jenkins-bot [Tue, 11 Jun 2019 17:42:57 +0000 (17:42 +0000)]
Merge "resources: Remove unused jquery.effects.* modules"

4 years agoMerge "Normalize dir path in AutoLoaderStructureTest"
jenkins-bot [Tue, 11 Jun 2019 15:58:09 +0000 (15:58 +0000)]
Merge "Normalize dir path in AutoLoaderStructureTest"

4 years agoMerge "Move cookie-blocking methods to BlockManager"
jenkins-bot [Tue, 11 Jun 2019 15:16:00 +0000 (15:16 +0000)]
Merge "Move cookie-blocking methods to BlockManager"

4 years agoobjectcache: add object segmentation support to BagOStuff
Aaron Schulz [Fri, 8 Mar 2019 01:53:39 +0000 (17:53 -0800)]
objectcache: add object segmentation support to BagOStuff

Use it for ApiStashEdit so that large PaserOutput can be stored.

Add flag to allow for value segmentation on set() in BagOStuff.
Also add a flag for immediate deletion of segments on delete().

BagOStuff now has base serialize()/unserialize() methods.

Bug: T204742
Change-Id: I0667a02612526d8ddfd91d5de48b6faa78bd1ab5

4 years agoresources: Remove unused jquery.effects.* modules
Derick Alangi [Fri, 19 Apr 2019 18:25:14 +0000 (19:25 +0100)]
resources: Remove unused jquery.effects.* modules

* jquery.ui.effect-bounce [removed]
* jquery.ui.effect-explode [removed]
* jquery.ui.effect-fold [removed]
* jquery.ui.effect-pulsate [removed]
* jquery.ui.effect-slide [removed]
* jquery.ui.effect-transfer [removed]

Bug: T219604
Change-Id: I9a9acd8ed3d4a3b6c50f57fbb11e6038713a2a09

4 years agoMerge "Have ServiceContainer implement PSR-11"
jenkins-bot [Tue, 11 Jun 2019 14:39:55 +0000 (14:39 +0000)]
Merge "Have ServiceContainer implement PSR-11"

4 years agoMerge "Replace some uses of deprecated wfFindFile() and wfLocalFile()"
jenkins-bot [Tue, 11 Jun 2019 14:23:24 +0000 (14:23 +0000)]
Merge "Replace some uses of deprecated wfFindFile() and wfLocalFile()"

4 years agoMerge "Fix return type of File::restore()"
jenkins-bot [Tue, 11 Jun 2019 14:20:09 +0000 (14:20 +0000)]
Merge "Fix return type of File::restore()"

4 years agoMove cookie-blocking methods to BlockManager
Thalia [Thu, 6 Jun 2019 18:00:20 +0000 (14:00 -0400)]
Move cookie-blocking methods to BlockManager

Move the cookie blocking logic into one place. Specifically, move
these methods to the BlockManager:
* User::trackBlockWithCookie
* DatabaseBlock::setCookie
* DatabaseBlock::clearCookie
* DatabaseBlock::getCookieValue
* DatabaseBlock::getIdFromCookieValue
* AbstractBlock::shouldTrackWithCookie

After this, BlockManager::trackBlockWithCookie should be called to
track a block, and BlockManager::clearBlockCookie should be called
to unset the cookie. The other methods in the above list are
helper methods that are made private or marked internal.

Also update places in core that call User::trackBlockWithCookie to
BlockManager::trackBlockWithCookie

Bug: T225141
Change-Id: I818962c6932c01c841a549a101637e00a7593e48

4 years agordbms: add Database::executeQuery() method for internal use
Aaron Schulz [Wed, 22 May 2019 20:31:59 +0000 (13:31 -0700)]
rdbms: add Database::executeQuery() method for internal use

This shares reconnection and retry logic but lacks some of the
restrictions applied to queries that go through the public query()
interface.

Use this in a few places such as doSelectDomain() for mysql/mssql.

Bug: T212284
Change-Id: Ie7341a0e6c4149fc375cc357877486efe9e56eb9

4 years agoMerge "Set cache types to APC/APCu/WinCache in DevelopmentSettings.php"
jenkins-bot [Tue, 11 Jun 2019 13:53:05 +0000 (13:53 +0000)]
Merge "Set cache types to APC/APCu/WinCache in DevelopmentSettings.php"

4 years agoReplace some uses of deprecated wfFindFile() and wfLocalFile()
Derick Alangi [Tue, 14 May 2019 17:00:34 +0000 (18:00 +0100)]
Replace some uses of deprecated wfFindFile() and wfLocalFile()

These global functions were deprecated in 1.34 and services made
available to replace them. See services below;

* wfFindFile() - MediaWikiServices::getInstance()->getRepoGroup()->findFile()
* wfLocalFind() - MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()->newFile()

NOTES:

* wfFindFile() and wfLocalFind() usages in tests have been ignored
  in this change per @Timo's comments about state of objects.

* includes/upload/UploadBase.php also maintained for now as it causes
  some failures I don't fully understand, will investigate and handle
  it in a follow up patch.

* Also, includes/MovePage.php

Change-Id: I9437494de003f40fbe591321da7b42d16bb732d6

4 years agoFix return type of File::restore()
Lucas Werkmeister [Tue, 11 Jun 2019 12:35:23 +0000 (14:35 +0200)]
Fix return type of File::restore()

The only real implementation, LocalFile::restore(), has not returned an
int|bool since commit ca76169bbe, almost twelve years ago. (MediaWiki
code search [1] finds no other implementations.)

This discrepancy became more visible when we moved from wfLocalFile() to
FileRepo::findFile(), because wfLocalFile() (incorrectly, as it just
calls FileRepo::findFile()) is declared to return a LocalFile, rather
than any File as FileRepo::findFile() does, so the incorrect return type
on File::returnType() was not seen by wfLocalFile() users.

[1]: https://codesearch.wmflabs.org/search/?q=function%20restore\(&files=\.php%24

Change-Id: Idaf73074eaddc5be1782ae484d75a0f0c129b980

4 years agoMerge "Remove return value from SpecialUploadStash::execute"
jenkins-bot [Tue, 11 Jun 2019 11:54:07 +0000 (11:54 +0000)]
Merge "Remove return value from SpecialUploadStash::execute"

4 years agoMerge "api: Temporarily disable ApiQueryLanguageinfoTest"
jenkins-bot [Tue, 11 Jun 2019 11:53:59 +0000 (11:53 +0000)]
Merge "api: Temporarily disable ApiQueryLanguageinfoTest"

4 years agoSet cache types to APC/APCu/WinCache in DevelopmentSettings.php
Amir Sarabadani [Tue, 11 Jun 2019 11:21:54 +0000 (13:21 +0200)]
Set cache types to APC/APCu/WinCache in DevelopmentSettings.php

Bug: T225496
Change-Id: I14dd3fea9795a501e29383a3cae2b3e9a0077e69

4 years agoMerge "Allow MediaWikiTestCase::editPage to use given User"
jenkins-bot [Tue, 11 Jun 2019 00:28:34 +0000 (00:28 +0000)]
Merge "Allow MediaWikiTestCase::editPage to use given User"