Commit graph

482 commits

Author SHA1 Message Date
Umherirrender
ec6fd49107 language: Fix nullable documentation for property, args and return types
Change documentation to null or false where the type is allowed

Change-Id: Ibc17388c065605defed0d3f0998971c9987ff63f
2021-10-20 20:17:09 +00:00
Tim Starling
f7f84dddb3 Introduce CommentFormatter
CommentParser:

* Move comment formatting backend from Linker to a CommentParser service.
  Allow link existence and file existence to be batched.
* Rename $local to $samePage since I think that is clearer.
* Rename $title to $selfLinkTarget since it was unclear what the title
  was used for.
* Rename the "autocomment" concept to "section link" in public
  interfaces, although the old term remains in CSS classes.
* Keep unsafe HTML pass-through in separate "unsafe" methods, for easier
  static analysis and code review.

CommentFormatter:

* Add CommentFormatter and RowCommentFormatter services as a usable
  frontend for comment batches, and to replace the Linker static methods.
* Provide fluent and parametric interfaces.

Linker:

* Remove Linker::makeCommentLink() without deprecation -- nothing calls
  it and it is obviously an internal helper.
* Soft-deprecate Linker methods formatComment(), formatLinksInComment(),
  commentBlock() and revComment().

Caller migration:

* CommentFormatter single: Linker, RollbackAction, ApiComparePages,
  ApiParse
* CommentFormatter parametric batch: ImageHistoryPseudoPager
* CommentFormatter fluent batch: ApiQueryFilearchive
* RowCommentFormatter sequential: History feed, BlocklistPager,
  ProtectedPagesPager, ApiQueryProtectedTitles
* RowCommentFormatter with index: ChangesFeed, ChangesList,
  ApiQueryDeletedrevs, ApiQueryLogEvents, ApiQueryRecentChanges
* RevisionCommentBatch: HistoryPager, ContribsPager

Bug: T285917
Change-Id: Ia3fd50a4a13138ba5003d884962da24746d562d0
2021-09-28 11:13:03 -07:00
Derick Alangi
db43511e6a Title: Make use of BacklinkCacheFactory service
Change-Id: I48161585de6f329ec4037156234e0b07b3b837e6
2021-09-09 14:04:02 +01:00
Umherirrender
07b499fbcf build: Update mediawiki/mediawiki-phan-config to 0.11.0
Addition and remove of suppression needs to be done with the version
update.

Change-Id: I3288b3cefa744b507eadebb67b8ab08c86517c1c
2021-09-07 17:19:05 +02:00
Umherirrender
e29cd309d1 changes: Remove ChangesList->skin
Each Skin is a IContextSource, which makes the instanceof checks in the
constructor not needed

Change-Id: Ie44ee72c70956da5f82cd6b562e527a485030b51
2021-09-03 23:03:24 +02:00
Umherirrender
57b196cac3 docs: Improve doc types around changes list and the changes special page
Add type hints to closures and fix doc types

Change-Id: Ib864f1b4c384bc0cd553596b5dd5ba05a3f4f22d
2021-08-31 19:13:35 +02:00
Fomafix
09a79fb016 EnhancedChangesList: Use parent::beginRecentChangesList()
Change-Id: I72b56a15371b5ab42358ce7c10db72cb491a091c
2021-07-03 20:51:33 +00:00
DannyS712
47d70dbfba Post Revision-removal cleanup
Updates for the removal of the Revision class itself
and the various methods/hooks/variables removed in the
process, including:

- Update some documentation removing most references
to the Revision class and updating the MCR migration
notes to reflect the past tense for Revision methods.

- Change some capitalization from "Revision" to "revision"
to make it clear comments are about revisions in general,
not the Revision class in particular.

- Minor code tweaks including removing unused variables that
were around for the old hooks that were removed, and
removing the use of DeprecatablePropertyArray where no
longer needed for anything.

- Fix incorrect documentation for PageUpdater::getStatus(),
the status value changed a while ago to have revision-record
in addition to revision, and recently to only have the
revision-record, but ironically PageUpdater was never updated.

- Removed Parser::$mRevisionObject, used to be a Revision object
and was deprecated in 1.35, missed earlier because it was no
longer being set to Revision objects, always null.

- Add RevisionRecord typehints in DummyLinker to match those
in the corresponding Linker methods

This should be a no-op in terms of functionality.

Bug: T247143
Change-Id: I03bbb94fc29085855448780b1a5ad9063911ecc4
2021-06-24 00:32:39 +00:00
Thiemo Kreuz
2ba01c7ee7 Remove some more comments that literally repeat the code
… including PHPDoc tags like `@return <type> $variableName`.
A return value doesn't have a variable name. I can see that
some people do this intentionally, repeating the variable
name that was used in the final `return $var;` at the end
of a method. This can indeed be helpful. I leave a lot of
these untouched and removed them only when it's obviously
wrong, or does not provide any additional information in
addition to what the code already says.

Change-Id: Ia18cd9f25ef658b08ad25b97a744897e2a8deffc
2021-06-18 21:23:56 +00:00
Roman Stolar
e221991e86 Hard deprecate RecentChange::getPerformer()
Added deprecation warning

Bug: T276412
Change-Id: I642a2903f7a1d6861dd5e50e8754980adc937c53
2021-06-02 11:29:06 +03:00
DannyS712
f60ea069ba Remove remaining non-test uses of Revision objects
The following methods no longer support Revision parameters:
- CategoryMembershipChange::__construct
- ContentHandler::getUndoContent
- DerivedPageDataUpdater::prepareUpdate
- DifferenceEngine::getRevisionHeader

The following methods were removed entirely:
- Title::countAuthorsBetween

The following methods return arrays that formerly include
a 'revision' key that would emit deprecation warnings when
accessed and return a Revision object. The Revision object
has been removed from the arrays, and the 'revision-record'
key should be used to get the relevant RevisionRecord instead:
- PageUpdater::doModify
- PageUpdater::doCreate
- Parser::statelessFetchTemplate

The ParserOptions `templateCallback` option is a callback
that is called in Parser::fetchTemplateAndTitle() and should
return an array - the 'revision' key to that array used to
be a Revision object and was used if no 'revision-record'
was returned - it is now ignored.

Bug: T247143
Change-Id: I163ada88d649c75697aff4fa31a3a3c0bdef78b7
2021-05-04 13:10:22 -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
jenkins-bot
e0ee81aef7 Merge "Add classes to when a linked change is suppressed" 2021-04-29 15:57:22 +00:00
Amir Sarabadani
b6f148bec6 Add classes to when a linked change is suppressed
This also tries to centralize adding logic of adding history-deleted
class as well. To make future changes easier.

This doesn't affect history deletion on files, recentchanges, and logs yet

Bug: T23272
Change-Id: I08f14f712479e1b170c606e2b64857f8386acd76
2021-04-29 15:28:06 +00:00
Tim Starling
fd01c53778 Stop using legacy ActorMigration field "rc_user"
Bug: T278917
Change-Id: I4d6c175c637a2cb26c63e0b2b27d5ea8ce6b1e0d
2021-04-28 16:29:04 +10:00
jenkins-bot
e2abc63ac6 Merge "RecentChange: replace Title in method signatures" 2021-04-26 22:24:57 +00:00
daniel
c7eca76241 RecentChange: replace Title in method signatures
Bug: T278459
Change-Id: I144ea130f29ec437302649d86494034af044c524
2021-04-26 17:48:02 +02:00
James D. Forrester
f6667ab415 Remove ArticleEditUpdatesDeleteFromRecentchanges hook, deprecated in 1.35
Also move RC purging code.

Bug: T244613
Depends-On: I743b764ccd031df448cfac31a9bba3c60442d250
Change-Id: Ib455501c266f8482f56d08041de0f5beba651a0b
2021-04-21 14:38:59 -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
Umherirrender
78cc6d77ff build: Swap deprecated @codingStandardsIgnore to phpcs:ignore
Bug: T278594
Change-Id: I09a6175917090593e6e0055203a890c32bea03a5
2021-04-04 21:18:22 +02:00
mainframe98
f38fee2171 Fix missing styles on diff
The markers for minor, bot, unpatrolled and new page edits used to
be bolded, but weren't after I3f45c95d2856c8fce2da5175b52089d4e629a41e.
Move the relevant styles to mediawiki.interface.helpers.styles, which
is used on all places where these markers can be found.

Bug: T279099
Change-Id: I7af935da13669b6519ba770b413cb1ef027cac1c
2021-04-02 10:52:26 +02:00
Petr Pchelko
50c24f0374 RecentChange: directly build the user identity if we have the data
Bug: T277795
Change-Id: I87560b2fa68efde479dc97ce568f9e74533096d9
2021-03-25 15:49:12 -06:00
Petr Pchelko
9011bfd4cf Convert CategoryMembershipChange to Authority
Change-Id: Icbc1c7f7f248dfbc8a391f91d9b3608fdf2224a1
2021-03-24 11:47:26 -06:00
Petr Pchelko
eec331897e Replace various usages of PermissionManager with Authority
Change-Id: Idc303bdbbe2b7ce9e7011ee1f3926c781c56af71
2021-03-17 20:23:58 -06:00
jenkins-bot
9015e4fdc1 Merge "Deprecate UserIdentity::getActorId()" 2021-03-13 21:30:22 +00:00
daniel
4dce6dd0c3 Deprecate UserIdentity::getActorId()
Note: User::getActorId() is not (yet) deprecated.

Bug: T274179
Change-Id: Ic2ca6d489db821fc2334e53bf2496c7b0d3ea5b1
2021-03-13 19:45:57 +01:00
Reedy
6cb2989361 Add @since to RecentChange::getPerformerIdentity()
Change-Id: I96c3699d8f9d3eddc5c7de8f78a39d72030cb9ce
Follows-Up: Ib9fe44567660ec1e42cc788f69b9a4101a8a3460
2021-03-13 17:28:59 +00:00
daniel
5a058b7c18 Convert RecentChange to use UserIdentity and ActorStore
Note: this removes 'rc_actor' from the public attributes array.
There is no access to this field in any known extension.
It seemed to be there purely by analogy to the database schema.

Bug: T276853
Change-Id: Ib9fe44567660ec1e42cc788f69b9a4101a8a3460
2021-03-11 19:44:29 +01:00
Petr Pchelko
c4f28d017b Replace some usages of User with Authority/UserIdentity
Change-Id: I7dfbf9bbd1709f5e67de7f6680a5a5ad156994fa
2021-03-04 17:20:40 -07:00
Petr Pchelko
ea185c872e Rename Authority::getPerformer() to ::getUser()
We started to call Authority argument $performer everywhere,
and $performer->getPerformer() doesn't look that good.

Change-Id: Id2cf3f27b18340314e4ed1ea9931ad9404b4df6f
2021-03-04 12:45:28 -07:00
Petr Pchelko
7e799cc7f5 Convert RecentChange::doMarkPatrolled to Authority
Change-Id: If93d6133f61bf0801bbe979885e2fb120e01a33d
2021-03-03 20:23:56 -07:00
jenkins-bot
e585399247 Merge "Use Authority for revision audience where possible" 2021-02-25 16:31:44 +00:00
Petr Pchelko
782a46f661 Use Authority for revision audience where possible
Depends-On: I963a79d94b9e39086940a43945def7c8eff1536d
Change-Id: If99d428b391c0eaf61396565af7f38740bef6c4a
2021-02-24 10:56:50 -07:00
Thiemo Kreuz
c09f4fd6ef Fix and add various type hints
I keep fixing type hints in my local dev environment whenever I
see something that is worth updating. This is what I collected
over the past weeks.

Change-Id: Ia4f1b4bee2019abe4ab0fb0df8164e1b446229e7
2021-02-16 17:22:15 +00:00
jenkins-bot
563e73980b Merge "RecentChange: Cast rev_id attr value to integer" 2021-02-16 02:07:39 +00:00
Ammarpad
6a902dcf17 RecentChange: Cast rev_id attr value to integer
RevisionRecord::getId() returns int|null, and the null
can likely reach here via PageUpdater::doModify() or
from somewhere else.

RecentChange::diffLinkTrail() already casts it to integer.

Bug: T274748
Change-Id: I42acdcedf8ac8d1caa1ce41758a670d90e43f58a
2021-02-15 22:05:09 +01:00
Umherirrender
8de3b7d324 Use static closures where safe to use
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.

Created by I25a17fb22b6b669e817317a0f45051ae9c608208

Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
2021-02-11 00:13:52 +00:00
Petr Pchelko
8d2c674ab0 Introduce ActorStore, ActorLookup and ActorFactory.
The ActorNormalization factory methods create
UserIdentityValue from the database rows, either via
fields of a joined table, or via a row from actor table.
They assume that the actor_id exist and throw othervise.

ActorNormalization is a storage-layer service providing
access to finding and acquiring actor_id.

The UserIdentityLookup methods do not instantiate new actor
on demand, they just find an appropriate row in the actor
table and return the result.

Bug: T272689
Depends-On: I74d81f3f0233efb17fc8df5178e4c477cc669c6f
Change-Id: Icfa1daca960c696a8cef8adab5eab53985802858
2021-02-08 10:06:46 -06:00
Daimona Eaytoy
3a216d6e3a Relax User to UserIdentity in ManualLogEntry and RecentChange
This is obviously incomplete, but it should allow unit-testing in some
situations. Both these classes are ancient and should be refactored, so
there's probably no point in pushing this further for now.

Change-Id: Ie5563490cdc84cfa50b5248c248f0fd282de6075
2021-01-10 00:58:00 +00:00
Matěj Suchánek
75739cbd52 EnhancedChangesList::getDiffHistLinks: Fix version of deprecation
Follow-up to 23b4bdb153; the patch was merged into 1.36, not 1.35.

Change-Id: I20979df6d707e38b126d1dd36ce7209d1386acd7
2021-01-07 17:07:56 +00:00
Matěj Suchánek
23b4bdb153 Fix logic in getDiffHistLinks
Since it's a link to history, it should always have "action=history"
and "curid=". $query argument is now deprecated.

Bug: T264491
Change-Id: I9cae1afa62a714e4a56a5356ba9d6a955c81a5a9
2021-01-01 14:35:23 -08:00
James D. Forrester
abdc94a3da Swap out uses of User->isLoggedIn() with ->isRegistered()
Bug: T270450
Change-Id: I90ff94a553ebae9a4ef97c25c333f067f19c327d
2020-12-22 03:13:37 +00:00
Umherirrender
3f1c5d0eea Document list of change tags as string[]
Change-Id: I0ce2a8154af82a363fef126033b5819c4ee84842
2020-11-20 14:12:54 +01:00
jenkins-bot
e4001e0220 Merge "Annotate OldChangesList::recentChangesLine as returning a safe value" 2020-11-17 18:05:42 +00:00
jenkins-bot
4d5cef01eb Merge "Improve docs about @param/@return object[] $row to stdClass[]" 2020-11-15 02:15:35 +00:00
jenkins-bot
1317eb6298 Merge "Improve callable docs" 2020-11-13 23:28:34 +00:00
Umherirrender
4c2d2ec407 Improve docs about @param/@return object[] $row to stdClass[]
Change-Id: I4f85d90548caa1403e822ecb2333ab44787346f2
2020-11-13 23:38:06 +01:00
Umherirrender
98de078a4c Improve callable docs
Change-Id: I4cc9b2dbe285ad935a1dfd08effa673a39167483
2020-11-13 22:55:10 +01:00
jenkins-bot
1976283835 Merge "Update a lot of unspecific "array" types in PHPDocs" 2020-11-13 21:48:24 +00:00
Umherirrender
b9dc6b59ce Replace deprecated WikiCategoryPage::factory in RecentChange class
Change-Id: I8f984e5dafaed1b4ba68259aef69108df23f8f4b
2020-11-12 23:00:17 +01:00