Commit graph

10887 commits

Author SHA1 Message Date
Timo Tijhof
0be2e83ef4 resourceloader: Restore feedback for SkinModule invalid argument
This was added in 381499a675 in response to the issue that when a skin
adopts a feature that was new in MW 1.36, it caused an exception when
that version of the skin is then installed on MW 1.35. That's expected,
and generally helpful because the default support policy requires
like-for-like (MW 1.35 with REL1_35, this applies to all skins and
extensions, except for a few like Translate and SemanticMediaWiki).

However, while supporting LTS within master is unusual, there are
indeed the Translate/SemanticMediaWiki projects, and this problem has
already been solved years ago there by using a conditional with
$wgVersion. The proposed approach on T271441 actually also involves
such a conditional, but late at runtime instead of in the module
definition. Anyway, the way it was fixed in Timeless already solves
the problem by not passing down the invalid feature in the first
place, thus making the 381499a675 patch obsolete. I'm not aware of
any skin in Gerrit having such a compat policy, but if they exist,
they can fix it the same way, by defining the module in code with
a condition, just as Translate/SemanticMediaWiki do.

Bug: T271441
Change-Id: If97b3d04ac1e3355ee4f229db11e524d24ebd27a
2021-05-14 20:30:15 +00:00
Timo Tijhof
ae1db0cff0 resourceloader: Fix reliance on global state in SkinModule
* Remove odd use of ResourceLoaderFileModule::extractBasePaths()
  SkinModule.php which was basically just returning $IP.

* Use getConfig()->get('ResourceBasePath') so that the test does
  not need to override global configuration variables.

Follows-up 6845912bcf and f1457312dc.

Bug: T277728
Change-Id: I64262b48bb5dc71c53b4114eddb2f080a6a076f5
2021-05-14 20:29:53 +00:00
Timo Tijhof
2c8a8122a4 resourceloader: Simplify 'features' processing in SkinModule constructor
* Remove confusing dead code for T271441, as a continue statement at
  the end of a loop body does not do anything. I'll reinstate the
  exception once we've looked at whatever skin caused the issue and
  have fixed those repos to not pass invalid options.

* Simplify list creation by avoiding the loops and duplicate logic.
  Assign the list directly when possible, and otherwise store the
  filtered keys.

* Remove unexpected access to `$this->getConfig()` in the constructor.
  Follows-up a6c769e976, which worked by accident due to it defaulting
  to global state. The injection from ResourceLoader::getModule happens
  after the constructor. I am working on a patch to enforce this, and
  thus this change needs to land first.

  I've moved the logic to getStyleFiles() and boldly changed it to be
  a simple skip rather than based on whether it was specified. If this
  is a problem we can find a more complex way, but I wanted to try this
  first. It seems there is no reason to load these, specified or not,
  when the parser feature is not enabled. (Ref T266148)

  The unit test was working around this violation in a similar way,
  which is now redundant and removed in this patch.

* Document that compatibility method only works on map-form.

* Make applyFeaturesCompatibility() an internal and protected
  method. I don't think we'd support extensions calling this
  directly.

* Limit applyFeaturesCompatibility() to just dealing with
  the features array instead of also handling other options
  and applying of the default value.

Bug: T277728
Change-Id: I24a2b783570c888cedee66885647b3ed765e0132
2021-05-14 19:58:36 +00:00
jenkins-bot
f45965450f Merge "ArticleViewTest: Make timestamp tests deterministic" 2021-05-14 01:34:12 +00:00
jenkins-bot
1b0e2cd326 Merge "Article: Use correct timestamp for OutputPage::setRevisionTimestamp" 2021-05-14 01:34:05 +00:00
jenkins-bot
4d33cae7ce Merge "Make mw-content-body universal to all skins" 2021-05-14 01:08:19 +00:00
jdlrobson
7cda5b0bf8 Make mw-content-body universal to all skins
1) Rename content-parser-output to `content-body`

Widen the scope of this module to apply to anything that can be rendered
as the article body. Improve the documentation on what is allowed here.

For early-adopter skins already using content-parser-output,
map the feature to the new name and add tests.

2) Reclaim the `mw-body-content` class for result of
SkinTemplate::wrapHTML

The `mw-body-content` has been used in skins to wrap various elements.
Going forward we will use it to wrap any HTML content generated by
OutputPage.

See dependent patches, which we're not directly depending on to avoid
a CI gremlin:

 - I90d85c21f4a62e6697f24e3ce388445a0a53c2b0 (MonoBook)
 - I11242e243c9a529b72972089af9ac2a8c906331a (Modern)
 - I87942c60e62f6f14acdfeaa1836ace4eac9252ac (CologneBlue)
 - I4c1b15d90bacbc9b13782a1d8f52e838ce8ecd83 (Vector)

Bug: T279388
Change-Id: I3a91b294fcb3724cd46743e497dff723de0490a6
2021-05-13 16:53:52 -07:00
jenkins-bot
f1fe87e2b0 Merge "Add extension.json merge strategy "provide_default"" 2021-05-13 23:20:47 +00:00
jenkins-bot
97b18490fa Merge "resourceloader: Remove Title from public interfaces" 2021-05-13 15:41:03 +00:00
jenkins-bot
e4a674c589 Merge "ImportReporter: replace Title in method signatures" 2021-05-13 15:11:36 +00:00
daniel
fd2a9bf4a4 resourceloader: Remove Title from public interfaces
Bug: T278459
Depends-On: I9bc371fd299e7a5401ebc1b8d7456d9a4ecde90d
Change-Id: Ib3a0591766f873492ec5a24721e7840f4e1a6407
2021-05-13 10:06:30 +02:00
jenkins-bot
297d1bfb0e Merge "Remove unused default values from class properties" 2021-05-13 00:58:34 +00:00
jenkins-bot
5cdb8db7e6 Merge "TemplateCategoriesTest: remove unneeded require of runJobs.php" 2021-05-13 00:31:54 +00:00
jenkins-bot
fca9c972de Merge "Inject load balancers into some authentication providers" 2021-05-12 22:56:22 +00:00
jenkins-bot
0808bbfaa9 Merge "Simplify and cleanup TalkPageNotificationManagerTest" 2021-05-12 22:51:56 +00:00
jenkins-bot
b0987f19d0 Merge "ApiPageSet: replace Title in method signatures" 2021-05-12 22:51:49 +00:00
jenkins-bot
415cddae1d Merge "Hard deprecate the setters of SessionProvider class" 2021-05-12 22:48:43 +00:00
daniel
282e4ede1a ImportReporter: replace Title in method signatures
Bug: T278459
Change-Id: I9ff5f1989e15a1fe3988845abae935e6372d40ac
2021-05-12 23:25:21 +02:00
daniel
246c543737 ApiPageSet: replace Title in method signatures
Bug: T278459
Change-Id: Ie817fd476d6236791431b5ba5ce557800ef5222d
2021-05-12 23:17:59 +02:00
DannyS712
abb55334ac Simplify and cleanup TalkPageNotificationManagerTest
Instead of depending on full User objects, accept
UserIdentity(Value), we only needed User::getTalkPage
but that is trivial to recreate with UserIdentity.
By switching to UserIdentityValue objects, we can specify
the user id easily and not need to load from the database.
Also, give the anonymous user an ip address for the name.

Use a data provider for doTestUserHasNewMessages

Change-Id: I4d1d0226aeee154db42a31b56873e428cd46b64f
2021-05-12 21:15:26 +00:00
DannyS712
77ac7a9005 MWTimestampTest: use StaticUserOptionsLookup
Instead of needing to mess with a mock

Change-Id: Iff05a35d1c0f5834ed4c060f5f4c06268512e0bc
2021-05-12 21:05:48 +00:00
DannyS712
2ed29c04fc Remove MediaWikiIntegrationTestCase::formatErrorLevel, private and unused
Use was removed in I7dc3fe90385c8066b89a5e06c55f5455edfbb4ca
when the logic that was using it was moved to MediaWikiTestCaseTrait

Change-Id: I3be7fdb0ad3e76d0f0bff713c21cb9216b77ee20
2021-05-12 21:04:43 +00:00
vladshapik
39d093a49f Hard deprecate the setters of SessionProvider class
Bug: T282256
Change-Id: I97244429bb4aa05ffdeda381f89db5dbda182d31
2021-05-12 19:49:50 +00:00
Marius Hoch
c20d6764b0 ArticleViewTest: Make timestamp tests deterministic
These tests can be unstable as subsequent revision
may or may not have the same timestamp. This can
be problematic as we have tests that make sure Article
correctly uses the timestamp from the older revisions.

Bug: T282648
Change-Id: Ica585818faf6948249567cd3eacd29b0b63c0d38
2021-05-12 15:35:35 +02:00
Marius Hoch
754132a4a3 Article: Use correct timestamp for OutputPage::setRevisionTimestamp
Instead of always (except when reading from ParserCache),
using the latest version.
This can also clearly be seen by visiting an old revision on
Wikipedia (https://en.wikipedia.org/w/index.php?oldid=N)
and looking for "This page was last edited on …". When first
loading the old revision, the TS of the last rev will be shown,
upon reloading, the correct time will be shown (as the output
is fetched from parser cache).

This reverts the test removals from I83a43d651.

Bug: T282648
Change-Id: I517d4970d5c682489f27a65ba01ee30db9c62276
2021-05-12 15:22:35 +02:00
Thiemo Kreuz
6805f39a30 Remove unused default values from class properties
In all these cases the property is unconditionally set in
the constructor. The extra initialisation is effectively
dead code and an extra source of errors and confusion.

Change-Id: Icae13390d5ca5c14e2754f3be4eb956dd7f54ac4
2021-05-12 13:44:28 +02:00
Tim Starling
64b8677ca2 Merge "Revert flaky timestamp assertion in ArticleViewTest" 2021-05-12 10:10:16 +00:00
Tim Starling
3f6ca47e23 Revert flaky timestamp assertion in ArticleViewTest
testViewOfOldRevision failed for me in CI, and I was able to reproduce a
2% failure rate locally using --repeat.

I also removed the assertion from testViewOfOldRevisionFromCache() for
consistency, although I wasn't able to reproduce a failure there.

Partial revert of 929dbef76d.

Bug: T282648
Change-Id: I83a43d65123304f3bac47869bbf3a9826873b397
2021-05-12 09:10:10 +00:00
DannyS712
95ab3b9f9c Tests: stop calling MediaWikiIntegrationTestCase::editPage() statically
Its not a static method and should not be called as such

Change-Id: I9dfdeed38cba90293b1f8bf1de775b343d2de7a9
2021-05-12 07:37:24 +00:00
DannyS712
29e8f74b5c GenderCacheTest: fix call to overrideMwServices()
MediaWikiIntegrationTestCase::overrideMwServices() is not static
and should not be called statically

Change-Id: I9d1f07b5bca8a39b82017e59978f2b28c399803e
2021-05-12 07:37:19 +00:00
DannyS712
e814ebabf1 TemplateCategoriesTest: remove unneeded require of runJobs.php
Follow-up: I63603aa158f77df4b40add096cb248f3b24979f4
Change-Id: I0bfae0f9128b124b34e1808b0b005a05c3fbdf82
2021-05-12 07:02:02 +00:00
jenkins-bot
5f59120fa1 Merge "Deferred updates: remove Title from method signatures." 2021-05-12 03:50:58 +00:00
jenkins-bot
affe84360f Merge "Remove SearchResultPageIdentity interface" 2021-05-12 00:44:39 +00:00
jenkins-bot
d8765841c8 Merge "Article::generateContentOutput: Ensure OutputPage has rev id set" 2021-05-12 00:44:27 +00:00
jenkins-bot
063cf142b0 Merge "Fix changes list "hide myself" feature" 2021-05-12 00:13:00 +00:00
Tim Starling
8327d2f0ca Fix changes list "hide myself" feature
Broken by fd01c53778

Bug: T282183
Change-Id: I0ae68702f9ea160a1e649ca6c52f88cdf9a8e8e5
2021-05-12 09:45:59 +10:00
jenkins-bot
343015b83a Merge "getFooterIcons should not return empty arrays, part 2, Electric Boogaloo" 2021-05-11 23:29:38 +00:00
Marius Hoch
929dbef76d Article::generateContentOutput: Ensure OutputPage has rev id set
This should not default to latest revision id, but
Article::getRevIdFetched() if the ParserCache doesn't
have the id set. Also set the revision id before calling
OutputPage::addParserOutput to make sure the id is
already set when the "OutputPageBeforeHTML" hook is run
(which is the case in other code paths).

Additionally I've made the tests more robust, by no
longer manually getting the revision into parser cache.

Bug: T281587
Change-Id: I999195441f9d75a7e4bde4d843ad7729cdb1bee0
2021-05-11 21:33:12 +02:00
jenkins-bot
333b30069e Merge "Rewrite UserEditTrackerTest as an integration test" 2021-05-11 19:08:56 +00:00
jenkins-bot
e916b376e2 Merge "Return the action name instead of action id in API response" 2021-05-11 18:43:36 +00:00
jenkins-bot
8aa57b1d26 Merge "Introduce Block interface and replace AbstractBlock." 2021-05-11 18:13:54 +00:00
jenkins-bot
f2ba3c5bf8 Merge "Replace User::idFromName with ActorStore" 2021-05-11 15:21:08 +00:00
STran
a3e8ca737b Return the action name instead of action id in API response
When block restrictions are queried from the API, return the name
of the action blocked

Bug: T280566
Change-Id: I2e639864cfcdd3854fd67173b138fe8eb6f877cb
2021-05-11 07:48:52 -07:00
Petr Pchelko
7136d671d2 Replace User::idFromName with ActorStore
Depends-On: I87fdac02a88aba52a2174949f8736a9a36d3edf7
Depends-On: I812c49009665515778cd354d6c62a17ee24f3625
Change-Id: I5369e9714a3ec653c19ad81f02402e4aa1b22553
2021-05-11 07:44:38 -07:00
Petr Pchelko
695e61ce14 Clean up hard deprecated Title methods
Depends-On: If27bb6b5142d09bc9293d080e97b6642462219f4
Change-Id: I37f012e53d1c881292a19aac87eb107636c6bfbe
2021-05-11 07:41:18 -07:00
daniel
753b1bcaff Introduce Block interface and replace AbstractBlock.
In order to allow Authority to know about user blocks,
we need a narrow interface to represent such blocks.

This deprecates some methods on AbstractBlocks in favor
of new methods on the Block interface that avoid binding to
the User class.

Bug: T271494
Change-Id: I7bb950533970984a014de0434518fbbefb695131
2021-05-11 11:36:11 +02:00
daniel
0dec104bc0 Deferred updates: remove Title from method signatures.
This allows deferred update tasks to be constructed with a PageIdentity
rather than a Title instance.

Bug: T278459
Change-Id: Ifa2888fdef9ecc97f5bf09ae0b3fa7be48a0e9ef
2021-05-11 11:17:02 +02:00
Tim Starling
02ae9aa0ba Rewrite UserEditTrackerTest as an integration test
As previously discussed, the database should usually not be mocked. I'm
changing many of these queries for the next stage of the actor
migration, and just copying my own query from the code to the test file
does not give me any confidence that the query I'm writing is correct.
The unit test was simply ensuring that the implementation of the class
doesn't change, it wasn't verifying correct operation.

Change-Id: Id3ee02fd547d0a7b5b7f35866ee317e8b09e6c18
2021-05-11 13:03:45 +10:00
jenkins-bot
1bfa8e0791 Merge "Pass PageReference as possible parameter to LinkRenderer methods" 2021-05-11 01:28:31 +00:00
James D. Forrester
269e7e1d44 Drop global function wfNegotiateType, deprecated in 1.36
No uses known in code search.

Bug: T264984
Change-Id: Ia69d3a11653671d46e71f9248e0e62445f4f9d54
2021-05-10 15:09:49 -07:00