Commit graph

34 commits

Author SHA1 Message Date
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
DannyS712
ae4efe66c6 Don't pass unneeded variables into anonymous functions
Change-Id: Iad4d1dc4727828f9e0120c8bf99dc245a29ee14d
2021-07-13 19:48:26 +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
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
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
DannyS712
c0dd682544 Start removing places using Revision objects
- EditPage::$mBaseRevision
- EditPage::getBaseRevision()
- Title::getFirstRevision()
- LinksUpdate::setRevision()
- LinksUpdate::getRevision()
- Article::$mRevision
- Article::getRevisionFetched()
- WikiPage::getOldestRevision()
- WikiPage::getRevision()
- ContribsPager::tryToCreateValidRevision()

To make things easier, instead of rewritting
the Revision tests that were using WikiPage::getRevision,
just delete them, its not worth the effort to rewrite
them since the class is going away. For the WikiPage
tests, replace uses of getRevision with getRevisionRecord,
manually converting to a Revision object where needed

Bug: T247143
Change-Id: I52bc1f49649f8bd25797e3f7a090bec9c63ac2d1
2021-04-30 12:33:15 -07:00
Daimona Eaytoy
535d7abf59 phpunit: Mass-replace setMethods with onlyMethods and adjust
Ended up using
  grep -Prl '\->setMethods\(' . | xargs sed -r -i 's/setMethods\(/onlyMethods\(/g'

special-casing setMethods( null ) -> onlyMethods( [] )

and then manual fix of failing test (from PS2 onwards).

Bug: T278010
Change-Id: I012dca7ae774bb430c1c44d50991ba0b633353f1
2021-04-16 20:15:00 +02:00
Umherirrender
a1de8b8700 Tests: Mark more more closures as static
Result of a new sniff I25a17fb22b6b669e817317a0f45051ae9c608208

Bug: T274036
Change-Id: I695873737167a75f0d94901fa40383a33984ca55
2021-02-09 02:55:57 +00:00
Máté Szabó
899b6bd721 WikiPage: Add process cache for content model
WikiPage::getContentModel() gets called several times per request via
Action::getActionName(), triggering memcached I/O on each call. Excimer icicle
graphs for index.php indicate about 1.26% of time is spent in this method, so
let's add process caching to avoid redundant memcached fetches on subsequent
invocations.

Change-Id: Icdb9ffb849a0a0a264083957431495f8f4fb783e
2021-01-05 15:43:11 +01:00
Petr Pchelko
0eef0a6a3a Article: view from old revision cache - set correct revId.
Bug: T270361
Change-Id: Ice99038df450bb6892a5064b67f3d35f3255267b
2020-12-17 07:22:35 -06:00
DannyS712
649d20f6be Add dependency injection to RevDelList classes
Bug: T268713
Change-Id: I9ee516f4aa35e493a630299e8ba2c60edd4f06ba
2020-12-11 21:43:23 +00:00
Petr Pchelko
7cf60852fa Article::view - remove the old subtitle from doOutputFromParserCache.
The method is called from two places:
- For new revision ParserCache, when the subtitle doesn't need
to be applied. That call is protected by !oldid check
- For old revision cache, when subtitle is already applied before
checking the cache. So, no need to set it.

Bug: T269727
Change-Id: Ibec845ccfe43ae2cb4bbe0152c932cb74f3cef4b
2020-12-08 21:52:11 -06:00
Cindy Cicalese
39707515b0 Display error message without constructing a fake revision.
Change-Id: I67e32e73e77c335dcfeacfb045918133fd4d3870
2020-11-13 12:09:57 -05:00
Ammar Abdulhamid
6fe47ee97f Fix wrong title links on Special:Undelete
The links use {{FULLPAGENAMEE}} magic word which would resolves to
'Special:Undelete' on the diff page, therefore giving wrong target
title for the logs

Bug: T196669
Change-Id: Ibcd58cea23dbca8e24b638c6f6ee5e764f32ff26
2020-07-14 20:03:16 +00:00
DannyS712
0637d80572 Hard deprecate the rest of the Revision class
Bug: T246284
Change-Id: I126d7892c90aa2200c668b5717820e729613bed8
2020-07-02 09:02:02 +00:00
addshore
959bc315f2 MediaWikiTestCase to MediaWikiIntegrationTestCase
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)

My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.

Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
2020-06-30 17:02:22 +01:00
DannyS712
ca8aa4d6b2 Replace uses and hard deprecate Article::getRevisionFetched
Returns a Revision object; only deployed uses are in core
Make fetchRevisionRecord public as the replacement
Also removes a use of Revision::getContentHandler

Bug: T249393
Bug: T250981
Change-Id: Ib8f399e451c3a9b942001b48ea9a138f405c894c
2020-04-24 04:01:32 +00:00
DannyS712
4721717527 Replace uses and hard deprecate Article:: and WikiPage::getRevision
Bug: T250532
Bug: T239975
Change-Id: Ic8f2baa0ac805d5196a7107bdc7a1abb36eba139
2020-04-20 23:06:48 +00:00
ArtBaltai
726a2650d3 Remove direct access to Action::page and Article::page properties
Bug: T239975
Change-Id: Id0d4d1e099edbdd67cabbed423dfff68cc48d323
2020-03-27 04:10:51 +00:00
DannyS712
cf2c2a0778 Tests: Replace ::doDeleteArticle with WikiPage::doDeleteArticleReal
Not including WikiPageDbTestBase, which is testing the method

Bug: T248000
Change-Id: I1848a79be9e25759654053e88ef956269342f588
2020-03-25 11:34:17 -07:00
Daimona Eaytoy
c1d6e8b0b9 page: Remove the ArticleAfterFetchContentObject hook
Deprecated since 1.32, and no longer used anywhere.
It is referenced in ApprovedRevs, but conditional on a MW < 1.35
context only.


Change-Id: I415927f198473ae3e795fac8c4811690424f167a
2020-03-20 01:40:01 +00:00
DannyS712
f14fad3538 Remove ArticleContentViewCustom hook, deprecated and unused
Bug: T241351
Change-Id: Ie37ed9265511e3051ea60c6898febb567d5283df
2020-02-06 19:55:16 +00:00
Daimona Eaytoy
2e02e7fdb1 Fix most PHPUnit 8 compat issues in DBless tests
This patch fixes all PHPUnit 8 compat issues in the DBless suite, aside
from assertArraySubset.

Bug: T192167
Change-Id: Iea782386509b9e579f06d63687669e14bc437fad
2019-12-15 00:24:21 +00:00
Daimona Eaytoy
f5529400cc Stop using assertContains with string haystack
This was done automatically by replacing every assertContains with
string *needle*. Then verifying the results.

Bug: T192167
Change-Id: Id8cbbf3b01e948f80046714183cc299f86be21fd
2019-12-15 00:22:44 +00:00
Max Semenik
48a323f702 tests: Add explicit return type void to setUp() and tearDown()
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
2019-10-30 14:31:22 -07:00
Max Semenik
b0a8b0d275 Cleanup of old PHPUnit usage, part 3
Bug: T192167
Bug: T234597
Change-Id: I88a1ced51d7b57bc683de4a58bbeaa1537762113
2019-10-05 00:00:45 -07:00
Thiemo Kreuz
8a4e15db7f Add missing newline between <?php and namespace/use section
The rest of the codebase is using this code formatting standard.

Change-Id: I4d2ba61757a7e28d40096d9dc5915005c340d4f2
2019-06-03 13:36:48 +00:00
Bill Pirkle
d993f499ee Refactor calls to deprecated function Content::getNativeData()
Function Content::getNativeData() was deprecated.  Replace with
calls to new function TextContent::getText() in most places.

Bug: T155582
Change-Id: I2bd508c72aac4faf474ba45ab1f92e2e8d2eb9be
2019-02-15 17:48:01 +00:00
Brad Jorsch
dff469a408 Re-namespace RevisionStore and RevisionRecord classes
During development a lot of classes were placed in MediaWiki\Storage\.
The precedent set would mean that every class relating to something
stored in a database table, plus all related value classes and such,
would go into that namespace.

Let's put them into MediaWiki\Revision\ instead. Then future classes
related to the 'page' table can go into MediaWiki\Page\, future classes
related to the 'user' table can go into MediaWiki\User\, and so on.

Note I didn't move DerivedPageDataUpdater, PageUpdateException,
PageUpdater, or RevisionSlotsUpdate in this patch. If these are kept
long-term, they probably belong in MediaWiki\Page\ or MediaWiki\Edit\
instead.

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

Bug: T205578
Change-Id: Ic7cdb38f658f6d85c48ff13c7f84c64a45c9b1ee
2018-10-02 03:53:28 -07:00
Gergő Tisza
6e8d39c6e7
Add constant for the name of the 'main' slot for MCR
Bug: T202142
Change-Id: I97a74e5a029b014f3c2195188936d5c8233c1b7f
2018-09-24 16:52:12 -07:00
daniel
4835a75ec5 Use RevisionRenderer for rendering ParserOutput
Bug: T174035
Bug: T174036
Change-Id: I1085b05d635dd954c143c8a398fae909632ba0a9
2018-09-11 15:25:39 +00:00
daniel
9b6a3dcb1d Add tests for article viewing
Bug: T174035
Change-Id: I06dc78853169812b17e0bde733d9306ccd687564
2018-08-28 19:22:26 +02:00