Commit graph

7523 commits

Author SHA1 Message Date
jenkins-bot
c63a37679c Merge "language: Move ConverterRule to includes/ and add test case" 2019-08-26 15:09:13 +00:00
Timo Tijhof
7eef775b27 language: Move ConverterRule to includes/ and add test case
Add a very basic test that creates an instance, invokes it
with an empty string, and asserts the types and values returned
by the public methods used in LanguageConverter::applyManualConv.

Bug: T225756
Change-Id: I3600260e712f019243ba5f00890011e694444e43
2019-08-26 12:32:14 +01:00
jenkins-bot
fb9b23f4ad Merge "title: Fix flaky TitlePermissionTest::testUserBlock" 2019-08-26 04:35:59 +00:00
jenkins-bot
e59c70814e Merge "resourceloader: Add coverage for internal Context::getReqBase()" 2019-08-25 22:15:02 +00:00
Timo Tijhof
ebee319473 resourceloader: Add coverage for internal Context::getReqBase()
Change-Id: I068000f55f2100a6791470896d7f1050bdcb19a4
2019-08-25 19:03:04 +01:00
jenkins-bot
a34c284b1a Merge "Revert "rdbms: make LoadBalancer::reallyOpenConnection() handle setting DBO_TRX"" 2019-08-25 17:09:21 +00:00
Urbanecm
6ded91313c Revert "rdbms: make LoadBalancer::reallyOpenConnection() handle setting DBO_TRX"
This reverts commit 45831e619c.

Reason for revert: Caused beta not work at all.

Bug: T231162
Change-Id: Icc5c1fa0dc01082a622641ad96c22c939cd56d48
2019-08-25 16:39:33 +00:00
Timo Tijhof
b9f1978042 title: Fix flaky TitlePermissionTest::testUserBlock
The mock timestamp is asserted via $prev, which is set a few lines
up.

The input timestamp is set as 0, which usually passes (if these two
lines execute in the same second), but when the two lines of code
are on opposite sides of a clock second boundary, the test would
fail.

Instead of fixing the setTimestamp() call, remove it in favour of
fixing the 'timestamp' option instead, which was needlessly
being set to one thing and then overwritten by setTimestamp.

Bug: T231166
Change-Id: If6a1e4ec7b91efee0a43e6dd86794f15c5a440b3
2019-08-25 16:04:19 +01:00
jenkins-bot
358348d9bf Merge "rdbms: add setTempTablesOnlyMode() to suppress CONN_TRX_AUTOCOMMIT during tests" 2019-08-25 15:02:48 +00:00
Aaron Schulz
b1b01d8e3c Make NameTableStore use LoadBalancer::getConnectionRef()
This method handles reuseConnection() calls, disallows writes to
DB_REPLICA role handles, is more consistent with wfGetDB(), and
is more efficient with I540b08920997c5.

Change-Id: I8edaef0ea4718414e2004fad04afca8ec5797669
2019-08-25 01:24:16 +00:00
Aaron Schulz
bee2a20903 objectcache: make WANObjectCache::relayPurge() actually use $holdoff
Fixes a regression introduced by 70547f3fa3 in 2016.

Change-Id: I5996b63c31ac3b382e838a6858b8585bdc8c585c
2019-08-24 22:41:39 +00:00
jenkins-bot
8b7015681e Merge "resourceloader: Map group names to integers internally" 2019-08-24 22:40:59 +00:00
jenkins-bot
189fa1c2c0 Merge "resourceloader: Add tests for disallowing access to private modules" 2019-08-24 22:20:32 +00:00
jenkins-bot
11a26311da Merge "rdbms: make LoadBalancer::reallyOpenConnection() handle setting DBO_TRX" 2019-08-24 20:55:48 +00:00
Aaron Schulz
45831e619c rdbms: make LoadBalancer::reallyOpenConnection() handle setting DBO_TRX
Make LoadBalancer::reallyOpenConnection() handle initializing DBO_TRX
instead of Database::__construct().

Also:
* Avoid having the "catch" block appear like it returns a
  half-constructed Database.
* Use the variable name $conn instead of $db to be consistent
  throughout the class. Only send Database::__construct() parameters
  that it recognizes instead of mixing in setLBInfo() data.

Change-Id: Iffc3d1d0713051a164adb51a4c4ee12e4ac887c3
2019-08-24 20:06:17 +00:00
Aaron Schulz
94eb0c946f objectcache: improve BagOStuff arithmetic method signatures
Make the default $init value for incrWithInit() be $value.
This is far less suprising and also makes the operation
easier to replicate without conflicts.

Make decr() definitions more explicit since various cache
drivers do not handle negative incr() values (e.g. memcached).

Change-Id: I2b8d642656cc91c841abbd7a55d97eba101b027a
2019-08-24 12:50:37 -07:00
Amir Sarabadani
c59b0ed189 resourceloader: Map group names to integers internally
This makes startup response smaller.

Change-Id: Id0ae3cd7cd22163f42b92b629c38b0a806d3ca50
2019-08-24 20:36:37 +01:00
Timo Tijhof
e1bf44cd21 resourceloader: Add tests for disallowing access to private modules
* Add a test to confirm that the ResourceLoader::respond() logic
  works as intended.

* Remove the client code for preventing it from being loaded.
  This can never happen in production unless there is a bug.
  Instead of optimising to avoid a pointless request that only
  happens when the software is broken, instead optimise for when
  the software is not broken by just letting it happen. The server
  already handles it just fine.

  This was originally added in 2015 with 1dd7390372 to reduce
  logspam, but that was instead fixed in 6d6b037e12 by making the
  log message debug-only (because it's not a software problem,
  it's a client-error, e.g. a broken user script or a third
  party trying out different things on the load.php entry point).

  Removing this makes the client a bit smaller, too :)

Change-Id: Ic5420d9329a73514f4fc27baa46ae58d94addafb
2019-08-24 20:36:37 +01:00
Aaron Schulz
b9e68b2d50 rdbms: various field name and style cleanups to Database
Rename Database::hasFlags() to sound less similar to getFlag()/setFlag().
The order of class fields is roughly:
* Objects and resources
* Configuration
* Mutable options that do not have to be kept in sync with the connection
* Session level state tracking (should be in sync with the connection)
* Transaction level state tracking (should be in sync with the connection)
* Results from or timestamp of the last time a certain event occurred

Change-Id: Ibdca2fefe7ed2c792344c5602b5191a950eed933
2019-08-23 20:34:12 +00:00
Piotr Miazga
b7204566d2 Deprecate skin functions that are not skin responsibilities
Skin shouldn't be responsible for providing requested revisionId
nor if that revision is the current revision.
The OutputPage object has all required information (both the
currentRevisionID and the current Title object).

Change-Id: I2dbae4c6968a2b3b3cea3e09977e9579609b4cc5
2019-08-23 13:21:11 +00:00
jenkins-bot
8390e37efc Merge "Move getRestrictionLevels from NamespaceInfo to PermissionManager." 2019-08-23 11:27:45 +00:00
jenkins-bot
8d27bc18ec Merge "Split some Language methods to LanguageNameUtils" 2019-08-23 11:16:28 +00:00
Aryeh Gregor
2e52f48c2e Split some Language methods to LanguageNameUtils
These are static methods that have to do with processing language names
and codes. I didn't include fallback behavior, because that would mean a
circular dependency with LocalisationCache.

In the new class, I renamed AS_AUTONYMS to AUTONYMS, and added a class
constant DEFINED for 'mw' to match the existing SUPPORTED and ALL. I
also renamed fetchLanguageName(s) to getLanguageName(s).

There is 100% test coverage for the code in the new class.

Change-Id: I245ae94bfc1f62b6af75ea57525139adf2539fe6
2019-08-23 12:52:35 +03:00
Petr Pchelko
3cc3d00bcc Move getRestrictionLevels from NamespaceInfo to PermissionManager.
Bug: T11977
Change-Id: I051be9148c98086fdf53a66a74bf7c28699016db
2019-08-22 14:32:38 -07:00
Ppchelko
ab9436fb9a Merge "Deprecate and replace usages of User:isAllowed{All,Any}" 2019-08-22 17:31:50 +00:00
jenkins-bot
e4ce770cbd Merge "Make LocalisationCache a service" 2019-08-22 16:46:41 +00:00
Aryeh Gregor
07a7bdce59 Some integration tests for LockManagerGroup
Change-Id: Ide94a260e5f96c4cfcf76c1ee9b8dcf486976263
2019-08-22 16:34:34 +03:00
Aryeh Gregor
e4468a1d6b Make LocalisationCache a service
This removes Language::$dataCache without deprecation, because 1) I
don't know of a way to properly simulate it in the new paradigm, and 2)
I found no direct access to the member outside of the Language and
LanguageTest classes.

Change-Id: Iaa86c48e7434f081a53f5bae8723c37c5a34f503
2019-08-22 14:25:18 +03:00
jenkins-bot
07163a20dd Merge "BadFileLookup to replace wfIsBadImage" 2019-08-22 08:16:51 +00:00
jenkins-bot
b5f4d95e4f Merge "Rewrite integration test for wfIsBadImage()" 2019-08-22 08:16:45 +00:00
Petr Pchelko
fd130247c2 Deprecate and replace usages of User:isAllowed{All,Any}
Bug: T220191
Change-Id: I197b8fadaa93e7b320fc19c10e3e09387fe09ad2
2019-08-21 18:36:16 -07:00
DannyS712
08ee999b70 Increase maximum length of automatic deletion summaries
Currently, the maximum length is hardcoded to 255 characters.
Instead, the maximum length should be based on the actually enforce
comment store limit.

Bug: T230962
Change-Id: I4379057f8f49fd8e5efa620164eea2867fde1bfc
2019-08-22 00:42:59 +00:00
jenkins-bot
1fe608ed1f Merge "parser: document what 0/null rev IDs do when given to Parser::parse" 2019-08-21 19:38:20 +00:00
jenkins-bot
0d6ef1c0b2 Merge "deferred: make DeferredUpdates::attemptUpdate() use callback owners for $fnameTrxOwner" 2019-08-21 19:38:13 +00:00
jenkins-bot
36a00f6d19 Merge "Convert PermissionManager constructor to use ServiceOptions." 2019-08-21 18:14:12 +00:00
Aaron Schulz
26b1ba3989 parser: document what 0/null rev IDs do when given to Parser::parse
This was extremely obscure and tricky to figure out before

Change-Id: Ibdbb669431819eecd34de508735864e977d51021
2019-08-21 11:13:49 -07:00
Aryeh Gregor
5e2199c5b0 BadFileLookup to replace wfIsBadImage
I think this probably shouldn't be directly in the MediaWiki namespace,
but I don't know where is a better place to put it.

In order to avoid gratuitous use of TitleFormatter, I changed the cache
format -- the old implementation used getPrefixedDBkey() and I switched
to an ns/dbkey pair. I also changed the cache keys to use SHA1 instead
of MD5, by Daniel's request.

The previous implementation cached the parsed blacklist for one minute
without invalidation, so it could return slightly stale results, but it
didn't retrieve the bad image list message on a cache hit. The new
implementation unconditionally retrieves the bad image list message, but
uses a hash of it in the cache key and caches for one day. The new
behavior happens to be more cleanly implementable in a service.

Bug: T200882
Bug: T139216
Change-Id: I69fed1b1f3cfc1aa149e0739780e67f6de01609d
2019-08-21 20:45:37 +03:00
Aryeh Gregor
5600df580a Rewrite integration test for wfIsBadImage()
In preparation for rewriting as a service. I didn't figure out how to
get file redirects to be tested.

Change-Id: Ic6669a19a13025744036f9f8adc4d1a25490fb42
2019-08-21 20:45:37 +03:00
Petr Pchelko
6dd64b7b9b Convert PermissionManager constructor to use ServiceOptions.
Change-Id: I36a3a2f338506ef14cc5d65b8bee2961a92d60da
2019-08-21 10:12:34 -07:00
jenkins-bot
d00185cb18 Merge "TempFSFileFactory service" 2019-08-21 16:21:01 +00:00
Aryeh Gregor
a83b33582a TempFSFileFactory service
This replaces TempFSFile::factory(), which is now deprecated.

Change-Id: I9e65c3867e26c16687560dccc7d9f3e195a8bdd6
2019-08-21 16:26:05 +03:00
jenkins-bot
80d2ef4683 Merge "Remove usages of deprecated User::getRights." 2019-08-21 08:15:34 +00:00
jenkins-bot
36fdf484e9 Merge "Replace User::isAllowed with PermissionManager." 2019-08-21 08:00:33 +00:00
Petr Pchelko
5bebae7f96 Remove usages of deprecated User::getRights.
Bug: T220191
Change-Id: Ia7472cf61765fe5fee9ae72cfa9b7060565dbe87
2019-08-20 19:43:54 -07:00
Petr Pchelko
1d286560d2 Replace User::isAllowed with PermissionManager.
Covers root includes, actions, api, block, changes,
changetags, diff and PermissionManager itself.

Bug: T220191
Change-Id: Ic027d32f5dd8f4c74865df0c8a9fcf91123c889c
2019-08-20 14:43:51 -07:00
jenkins-bot
43ca34e912 Merge "Tests: Set dbname for DatabaseSqliteTest" 2019-08-20 16:51:53 +00:00
jenkins-bot
90d6f495bd Merge "objectcache: fix WRITE_ALLOW_SEGMENTS in BagOStuff cas() and add() methods" 2019-08-20 15:50:58 +00:00
jenkins-bot
dcb26aa2db Merge "RCFilters: add namespace filters for all contents and all discussions" 2019-08-20 15:20:02 +00:00
Aaron Schulz
942f708b61 objectcache: fix WRITE_ALLOW_SEGMENTS in BagOStuff cas() and add() methods
Add MediumSpecificBagOStuff::getValueOrSegmentList() helper method.

Also:
* Use $keysMissing variable correctly in CachedBagOStuff::getMulti()
  to avoid extra overhead.
* Optimize mergeViaCas() when the current value matches the new one.

Change-Id: I5c4bd74379bc459216ac0278150ce3aecff3b851
2019-08-20 10:55:42 -04:00
jenkins-bot
609091451b Merge "objectcache: make newFromId()/newWANcacheFromId()/getDefaultKeyspace() private" 2019-08-20 13:40:26 +00:00