Commit graph

34 commits

Author SHA1 Message Date
James D. Forrester
ad06527fb4 Reorg: Namespace the Title class
This is moderately messy.

Process was principally:

* xargs rg --files-with-matches '^use Title;' | grep 'php$' | \
  xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1'
* rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \
  xargs rg --files-with-matches 'Title\b' | \
  xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1'
* composer fix

Then manual fix-ups for a few files that don't have any use statements.

Bug: T166010
Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a
Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
2023-03-02 08:46:53 -05:00
Umherirrender
89b2d11a0d tests: Use Title::makeTitle instead of Title::newFromText
Avoid parsing known titles in tests to improve performance

Change-Id: Ie240eb42479d19714e64cc4606e26073fadc2e13
2022-09-23 21:53:11 +02:00
Umherirrender
8b1a3d13eb tests: Use WikiPageFactory to create WikiPage object
Bug: T259948
Change-Id: I9afcf3b845306f81ee5ca156553256e6c38df3a0
2022-06-26 23:21:02 +02:00
Umherirrender
2909d06a08 Use new namespace for revision related classes
All revision related classes are namespaced MediaWiki\Revision
instead of MediaWiki\Storage since 1.32. The old namespaced
class names are deprecated and only kept for backwards-compatibility.

Bug: T305784
Change-Id: I34e492d84d9fc4bc78481667202716d93b3c43cb
2022-04-14 23:03:43 +02:00
Daimona Eaytoy
2688c59606 tests: Replace usages of deprecated WikiPage::doDeleteArticleReal
Add a new helper to MediaWikiIntegrationTestCase, since deleting pages
seems to be pretty common in tests.

Some calls to WikiPage::factory were also updated to use WikiPageFactory.

Change-Id: I5b5100273a00ac292a1900022ca79708fa254347
2022-01-17 15:38:02 +00:00
Matěj Suchánek
b411cbfdaa Split PageArchiveTest
Create ArchivedRevisionLookupTest to test ArchivedRevisionLookup.
Expand tests a bit and add two more for ::getPreviousRevisionRecord.

Change-Id: I3e176b24a13479464b7e73d062639ecb4db86f8f
2021-10-25 10:41:33 +02:00
Matěj Suchánek
61289e0290 Deprecate replaced PageArchive methods
Change-Id: I07fe12e6e96c6a27b66655f179c09f624180daa3
2021-10-21 18:28:03 +02:00
Matěj Suchánek
21ec2fb282 Move methods from PageArchive to new ArchivedRevisionLookup
Copy and paste methods. Subsequent patches will tidy this up.
Also improve test coverage.

Bug: T290022
Change-Id: I549ecc3ec89f0303a3cc342916f06da4bf77595e
2021-10-08 10:30:49 +02:00
Daimona Eaytoy
beadd4454f Move code from PageArchive to a new UndeletePage command
This is just moving code verbatim, removing now-unneeded stuff, and
duplicating tests as well.

Bug: T290021
Change-Id: I540ddaaa11dfabcf0b87b608b151b5e34d199fd8
2021-09-21 16:11:29 +00:00
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
b45ddb2ab3 Use WikiPage::doUserEditContent() instead of ::doEditContent()
Results in passing a user where previously the fallback
to $wgUser was being used, mostly in tests.

Bug: T255507
Change-Id: Iabe24315b23c0ad1272353186425e71974528d23
2021-06-28 00:11:30 -07:00
Petr Pchelko
d6b3cd1a12 Remove hard-deprecated methods from RevisionStore
Bug: T274209
Change-Id: I1cdc9f2d4445cd5a32d90e9bbbfe16c65f1167ff
2021-06-24 12:42:49 -07:00
DannyS712
604d4063ad Remove Revision from PageArchive
- PageArchive::getArchivedRevision
- PageArchive::getPreviousRevision
- PageArchive::getRevision

Bug: T247143
Change-Id: I9a2f2171ffdd284c21a4bcf58ae0589f71450c9b
2021-04-30 21:14:13 +00:00
James D. Forrester
df5eb22f83 Replace uses of DB_MASTER with DB_PRIMARY
Just an auto-replace from codesniffer for now.

Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
2021-04-29 09:24:31 -07:00
daniel
fed7f0b179 Remove $actor field from UsererIdentityValue
Code that needs to store an actor ID in the database to
represent a UserIdentity, or needs to construct a UserIdentity based on
an actor ID loaded from the database, should use the ActorNormalization
service.

Note: The getActorId() method is removed from the UserIdentity interface,
but all concrete classes continue to support it for now.
UsererIdentityValue::getActorId() is hard deprecated and should
be removed in 1.37. It always returns 0.
User::getActorId() is not deprecated at this point.

Bug: T274179
Depends-On: Id2b3ddf6a2a7cdf90f8936a69148d2cce6fde237
Change-Id: I9925906d11e47efaec3c1f48d5cb3f9896a982c1
2021-04-13 18:18:06 +00:00
jenkins-bot
92a415a7d1 Merge "Remove constructors from test classes" 2021-03-11 09:56:01 +00:00
daniel
806792281f ActorNormalization should require a DB connection.
ActorNormalization should only be used in contexts where a DB connection
is already being used, or at least easily available.

Bug: T276986
Change-Id: Ie8aadaffa4a30e63fcad0502d45b8ec364fc79ef
2021-03-10 21:43:49 +01:00
DannyS712
24afc63e49 Remove constructors from test classes
Tests should put their setup code in ::setUp(),
rather than __construct

Change-Id: I622f017f3c78a72acc65310f37d61dbec2a5da79
2021-03-08 03:31:25 +00:00
Cindy Cicalese
2d302a936e Hard-deprecate IDatabase parameter for UserIdentity:getActorId()
Bug: T273576
Change-Id: I0df4a2749afae74671dc4c49bac4e18309677703
2021-02-17 12:51:02 -05:00
Peter Ovchyn
e7e0db5b34 Hard deprecate RevisionStore::newMutableRevisionFromArray
Bug: T272560
Depends-On: I171537c3346a7dd4aeb4fc612d7dd9fba5d64679
Change-Id: If8d079a5d0e9bc9103cf4a6893a9c961d2728534
2021-02-03 22:29:44 +00:00
Gergő Tisza
16c192f2af
Normalize IP addresses before writing/reading actor.actor_name
This was almost always happening already but handling it in
ActorMigration is less fragile.

Also recover some lost tests.

Bug: T272225
Change-Id: I24c82cfbd40595e79f64c6b0441c2cf789cfbbff
2021-01-26 22:56:30 -08:00
DannyS712
9b643b639d Remove hard deprecated PageArchive::undelete
Also fix alphabetization in release notes

Bug: T248192
Change-Id: I41c13b20d31aa75d86783a77a0a263b647a050c5
2020-08-26 23:45:06 +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
66f932e93b Tests: Reduce use of Revision objects
Rather than hiding deprecations, where possible use the RevisionRecord
This does not apply to tests explicitly meant to be testing Revision methods

Bug: T246284
Change-Id: Ic3d85a9d451c0c2ab5df35764186e7c383fdabec
2020-06-30 10:56:10 +00:00
DannyS712
dd938a8b5a Add PageArchive::getRevisionRecordByTimestamp
For internal use only
Allows deprecating PageArchive::getRevision

Bug: T249982
Change-Id: I0e10c1b6c7f56af9340f42d58ec4e8699e247be4
2020-06-15 23:02:50 +00:00
DannyS712
d95f663512 Hard deprecate Revision::getTimestamp
Bug: T254966
Change-Id: I90d42eb4e69d7a9ab5c6e0197fbe6979f589ddb6
2020-06-10 16:57:20 +00:00
DannyS712
f8cc519222 Hard deprecate Revision::getPage and ::getComment
Bug: T251853
Bug: T254960
Change-Id: I09fadbebd839a16b46a027f64eaac9a435622321
2020-06-10 04:10:41 +00:00
DannyS712
e36fc3a8dd Remove use of the Revision object returned in WikiPage::doEditContent
Each file's changes are independent and can be reviewed separately

Bug: T251853
Bug: T254952
Change-Id: I197c3db4cfb2ead920c8e6071120ae29543ee404
2020-06-09 23:38:03 +00:00
DannyS712
4194aa928f Hard deprecate PageArchive::getPreviousRevision
Bug: T251718
Change-Id: Id130da00ff22c193f11619bc75bf0f379216ec5a
2020-05-06 20:23:57 +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
DannyS712
3a46cdccf5 Replace PageArchive::getArchivedRevision with getArchivedRevisionRecord
No known callers outside of core

Bug: T249393
Change-Id: I00434d931f093f605a15d4dc62c97741f551bbf1
2020-04-08 07:48:09 +00:00
DannyS712
1d4df4f221 Hard deprecate Revision::getQueryInfo and ::getArchiveQueryInfo
Bug: T246284
Change-Id: I708f265aac3016e34d02936cf5dff98a3036ef0f
2020-03-26 23:53:19 +00:00
daniel
495323c063 Remove compat code for pre-MCR schema.
NOTE: This was manually tested to ensure it does not
break updates, see T242764.

Bug: T198557
Change-Id: I1d9f5465018bae10124514bc38169e23e0e613e6
2020-03-24 19:45:47 +01:00
Renamed from tests/phpunit/includes/page/PageArchiveTestBase.php (Browse further)