Commit graph

48 commits

Author SHA1 Message Date
Petr Pchelko
695e61ce14 Clean up hard deprecated Title methods
Depends-On: If27bb6b5142d09bc9293d080e97b6642462219f4
Change-Id: I37f012e53d1c881292a19aac87eb107636c6bfbe
2021-05-11 07:41:18 -07: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
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
fe9430947d Use PageStore in RevisionStore
This introduces PageStoreFactory as well.

Change-Id: I7abd3c6a8ea70a68e8f8e9460d3bdd8c6f45338a
2021-04-05 20:58:54 +02:00
daniel
ed7e42e42e RevisionStore: create getPage, deprecate getTitle
The new getPage() handles cross-wiki access correctly. It's not a direct
replacement for getTitle(), since it is private.

getTitle() cannot work properly for RevisionStore instances connected to
a sister-wiki. It was already discouraged, and is nearly unused outside
of RevisionStore. Remainign usages should be replaced with
RevisionRecord::getPage().

Note that PageIdentityValue is not lazy loading, while Title is.
Code in newRevisionFromRowAndSlots() was adjusted to take advantage of
any fields from the page table that may already be present from a join,
to avoid an additional query to the page table.

Bug: T275531
Bug: T273284
Change-Id: If4525d76a578b92dbcfe1f5150028f7a28811119
2021-03-17 10:53:40 +00:00
jenkins-bot
92a415a7d1 Merge "Remove constructors from test classes" 2021-03-11 09:56:01 +00:00
Petr Pchelko
eb5eca11b6 Deprecate constructing revision with non-proper page
Bug: T275531
Change-Id: If641a5a901210ba1a1ea6a41fa6a18c08f4183db
2021-03-10 22:05:06 +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
Peter Ovchyn
7d8bf01855 Clean up Title deprecated methods of mediawiki core
This patch hard-deprecates the following methods,
that are overdue for hard deprecation:

- ::getPreviousRevisionID
- ::getNextRevisionID
- ::getFirstRevision
- ::getEarliestRevTime

Also, it removes the following methods:
- ::countRevisionsBetween
- ::getAuthorsBetween

Bug: T274151
Change-Id: If022b907652efdad84180476649a612059c6ef18
2021-02-28 21:08:11 +02:00
Petr Pchelko
4d8dc6b992 Use ActorStore in RevisionStore
Bug: T273290
Change-Id: Iff9b67455d337ea03cb728dd570c4ce760c39e49
2021-02-10 14:37:54 -06: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
Peter Ovchyn
e7e0db5b34 Hard deprecate RevisionStore::newMutableRevisionFromArray
Bug: T272560
Depends-On: I171537c3346a7dd4aeb4fc612d7dd9fba5d64679
Change-Id: If8d079a5d0e9bc9103cf4a6893a9c961d2728534
2021-02-03 22:29:44 +00:00
Umherirrender
0347fd0631 Improve some function documentation in tests
Also fix some whitespaces

Change-Id: Ibed50a4f07442d3f299cf545c16f5dbb5f27a411
2021-01-14 22:13:55 +01:00
DannyS712
0637d80572 Hard deprecate the rest of the Revision class
Bug: T246284
Change-Id: I126d7892c90aa2200c668b5717820e729613bed8
2020-07-02 09:02:02 +00:00
DannyS712
a903da26e1 Revision: Hard deprecation constructing with an array or an object
All remaining deployed Revision objects are created with RevisionRecords

Bug: T246284
Change-Id: I08a0a146750d6bf29d127bf2a3d636e46b1ef336
2020-06-23 19:31:18 +00:00
DannyS712
d95f663512 Hard deprecate Revision::getTimestamp
Bug: T254966
Change-Id: I90d42eb4e69d7a9ab5c6e0197fbe6979f589ddb6
2020-06-10 16:57:20 +00:00
DannyS712
f04d825a8b Hard deprecate Revision::getSize
Bug: T254964
Change-Id: I79ff1671921f4d63829338d22126f8c0821bb16c
2020-06-10 05:19: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
df7906cd0f Hard deprecate Revision::getContent
Bug: T254703
Change-Id: I50e82d29f87725a2d583a0fc1ebacc467ffee935
2020-06-08 02:44:21 +00:00
DannyS712
b4d8adab32 Hard deprecate Revision::getContent(Model|Handler|Format)
Bug: T250981
Change-Id: I5b93e65f7a5b12e910c1e36fc39f60f498edf6c4
2020-06-03 23:52:49 +00:00
DannyS712
cc20c65b23 Hard deprecate Revision::newFromId
Bug: T249021
Change-Id: Iee63d5b0fe00dff9f43fcf5cbf43ac1516978e2e
2020-06-03 02:58:57 +00:00
DannyS712
94a47c715c Hard deprecate Revision::getPrevious and ::isDeleted
Bug: T251073
Bug: T251593
Depends-On: Iad9b2a1d571033308cd6940101faef0ce468889a
Change-Id: I5d56a51308d8a2983d86231e56d502406323e216
2020-06-03 00:25:37 +00:00
Tim Starling
68c433bd23 Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.

General principles:
* Use DI if it is already used. We're not changing the way state is
  managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
  is a service, it's a more generic interface, it is the only
  thing that provides isRegistered() which is needed in some cases,
  and a HookRunner can be efficiently constructed from it
  (confirmed by benchmark). Because HookContainer is needed
  for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
  SpecialPage and ApiBase have getHookContainer() and getHookRunner()
  methods in the base class, and classes that extend that base class
  are not expected to know or care where the base class gets its
  HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
  getHookRunner() methods, getting them from the global service
  container. The point of this is to ease migration to DI by ensuring
  that call sites ask their local friendly base class rather than
  getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
  methods did not seem warranted, there is a private HookRunner property
  which is accessed directly. Very rarely (two cases), there is a
  protected property, for consistency with code that conventionally
  assumes protected=private, but in cases where the class might actually
  be overridden, a protected accessor is preferred over a protected
  property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
  global code. In a few cases it was used for objects with broken
  construction schemes, out of horror or laziness.

Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore

Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router

setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine

Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-05-30 14:23:28 +00:00
DannyS712
511fd87645 Hard deprecate Revision::getParentId and ::getVisibility
Bug: T250980
Bug: T250714
Change-Id: I8084607090266687395612be26ad2c06f9a60baa
2020-05-27 23:35:18 +00:00
DannyS712
1e36b2c12f Hard deprecate Revision::getUserText, ::isMinor, and ::isCurrent
Bug: T250579
Bug: T250580
Bug: T250608
Change-Id: I89ac77c436245cad3e746b33aec5a42247fda67d
2020-05-26 22:19:54 +00:00
DannyS712
1c8afac4c2 Hard deprecate Revision::insertOn
Soft deprecated as part of the class in 1.31
Includes a fallback to $wgUser

Bug: T251856
Change-Id: I91702f3d541aeae37bf024a27346d7d773c29330
2020-05-21 03:22:05 +00:00
Reedy
12a3883a7b Fix SingleSpaceBeforeSingleLineComment
Change-Id: I285af438ce484af40741489797f20455726ec110
2020-05-11 00:57:11 +00:00
DannyS712
28cb11e8ca Replace uses and hard deprecate Revision::getSha1
Bug: T251233
Change-Id: I815db5120094909b2820b8ca56d65a62f6af82d1
2020-04-30 17:44:11 +00:00
DannyS712
232dc98d54 Hard deprecate Revision::getNext
Unused in deployed code, see codesearch:
https://codesearch.wmflabs.org/deployed/?q=-%3EgetNext%5C(%5C)&i=nope&files=%5C.php%24&repos=

Bug: T246284
Change-Id: Ic216093500418526029dde3a8ae4314b35361b13
2020-04-27 04:12:24 +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
0f826d1f73 Replace uses and hard deprecate Revision::newFromTitle
Also fixed a use of ::newFromId in benchmarkParse and Parser

Bug: T249183
Change-Id: I3219a72f1085836205dc497e2236b52db24d7c16
2020-04-18 04:47:10 +00:00
DannyS712
76cf98a3b1 Replace uses and hard deprecate Revision::newNullRevision
Bug: T249979
Change-Id: I84bb08032278248bbcc4d620a28f45504ab85d35
2020-04-15 05:43:43 +00:00
DannyS712
da0d5fdb96 Hard deprecate Article:: and WikiPage::getOldestRevision
Bug: T249393
Change-Id: I04d82adbb44bdbc4543707c5541887af774df4aa
2020-04-08 03:05:14 +00:00
DannyS712
fda65e7a27 Replace remaining uses and hard deprecate Revision::newFromArchiveRow
Bug: T248772
Change-Id: I44d0573b8af14d55e1c7423197dfae3cd55d7417
2020-04-01 20:18:33 +00:00
DannyS712
93e278b5db Hard deprecate Revision::getSerializedData
Bug: T246284
Change-Id: I49ac11b4f952b2494349cc49360501dd3bfc2c90
2020-03-31 16:33:04 +00:00
DannyS712
a96fd717a7 Hard deprecate Revision::getRecentChange and ::getTextId, both unused
Bug: T246284
Change-Id: I10197231642b45ad60e4588f94edad2bacf2f46e
2020-03-31 02:38:27 +00:00
DannyS712
aff1cfd0b0 Hard deprecate Revision::isUnpatrolled
Bug: T246284
Change-Id: I5817ec0041cb2119a5febc8dd57f66700743e752
2020-03-27 19:35:33 +00:00
DannyS712
1d4df4f221 Hard deprecate Revision::getQueryInfo and ::getArchiveQueryInfo
Bug: T246284
Change-Id: I708f265aac3016e34d02936cf5dff98a3036ef0f
2020-03-26 23:53:19 +00:00
DannyS712
ecf7f3fb28 Hard deprecate Revision::userWasLastToEdit
Bug: T246284
Change-Id: I908dd6025a2a78edf7d3c3661f540aeb498c4bad
2020-03-26 01:17:25 +00:00
DannyS712
90eb2dc46d Hard deprecate Revision::base36Sha1
Bug: T246284
Change-Id: I12b80940358ea2f941483b5edf74e8c8472ace31
2020-03-25 21:11:37 +00:00
jenkins-bot
5268ed3543 Merge "Hard deprecate Revision::loadFromTimestamp" 2020-03-25 19:44:45 +00:00
jenkins-bot
1576ae0c5a Merge "Deprecate Revision::loadFromPageId" 2020-03-25 19:24:01 +00:00
Petr Pchelko
aa1ea49a51 Hard deprecate Revision::loadFromTimestamp
Bug: T246284
Depends-On: Ia8d49b3158baf578ccd3476d6537be36dcea7e13
Change-Id: Ic4df02a7e21d4d1c0140e0f5a985a90f66983fab
2020-03-25 12:21:02 -07:00
jenkins-bot
56bf3cc24f Merge "Tests: Replace ::doDeleteArticle with WikiPage::doDeleteArticleReal" 2020-03-25 19:16:26 +00:00
Petr Pchelko
b3ab937939 Deprecate Revision::loadFromPageId
Bug: T246284
Depends-On: Id4ec83cc0ac0685857064486697a7daed979ea69
Change-Id: I5de750322e30052700f509d2908456ebd5be95ef
2020-03-25 12:10:48 -07:00
Petr Pchelko
a2cf98ef70 Remove usages and hard deprecate Revision::newFromRow
Also updates CategoryMembershipChange to accept a RevisionRecord
instead of a Revision.

Bug: T246284
Change-Id: I30024b7278e108b0f4e20ef1eb44647916fad47c
2020-03-25 11:42:36 -07: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
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/RevisionDbTestBase.php (Browse further)