Commit graph

632 commits

Author SHA1 Message Date
Reedy
2a2bb1e9bd Remove or replace usages of "sane"
Bug: T254646
Change-Id: I096b2cf738a1395a14f1d47bcbed0c2c686c2581
2021-11-22 13:35:17 +00:00
Reedy
7bf779524a Remove or replace usages of "sanity"
Bug: T254646
Change-Id: I2b120f0b9c9e1dc1a6c216bfefa3f2463efe1001
2021-11-19 23:19:42 +00:00
jenkins-bot
6f210f1128 Merge "Replace deprecated methods IContextSource::getWikiPage && IContextSource::canUseWikiPage" 2021-11-19 15:09:58 +00:00
Roman Stolar
ef458e8948 Replace deprecated methods IContextSource::getWikiPage && IContextSource::canUseWikiPage
Bug: T275710
Change-Id: I74b8f76a525793bc029d9ee1f7297b46ac0a9174
2021-11-16 13:58:39 +02:00
Umherirrender
171775e07b doc: Cleanup @param documentation
No extra sign needed between variable and description

Change-Id: Iaaaf62a3ffba7967aef8c31b121121b2830b74c4
2021-11-04 22:32:39 +01:00
C. Scott Ananian
df3cc40fac Rename ParserOutput::{allow,prevent}Clickjacking() -> ::{get,set}PreventClickjacking()
This name is consist with the rest of the setter and getter methods
in ParserOutput.  Renamed the methods in OutputPage, ImageHistoryList,
ImageHistoryPseudoPager, and ContribsPager as well for consistency;
it also makes chasing down lingering references in codesearch easier.

Soft-deprecated the old name for 1.38.  Hard-deprecation will follow,
but there are a number of users in production that should be chased
down first.

Code search:

https://codesearch.https://codesearch.wmcloud.org/deployed/?q=(allow%7Cprevent)Clickjacking&i=nope&files=&excludeFiles=&repos=

Bug: T287216
Change-Id: I9822c60c180d204bd30cb4447a1120155d456da4
2021-10-01 14:13:47 -04:00
Umherirrender
769bdbf091 docs: Fix nullable documentation for class properties
Change-Id: I6d0577124d852103f485ffdc819876a13f6641c3
2021-09-24 00:54:53 +00:00
Daimona Eaytoy
25e10bb38a Rename diff-related classes for LTR compatibility
Nothing in the code expects things to be on the left/right, it was just
a naming convention. However, it caused some issues because CSSJanus
flips the attributes in the stylesheet for RTL languages.

So just use more descriptive names that also avoid issues with RTL
languages.

Bug: T290731
Change-Id: I8a383cd1e3981dc8a826ff60eee523d9f71d1d3d
2021-09-17 22:58:44 +00:00
Umherirrender
44fd53fee3 Using @return never documentation on always-throw-function
This helps phan to detect unreachable code and also impossible types
after the functions.
It helps phan to avoid false positives for array keys
when the keys are checked before

Bug: T240141
Change-Id: I895f70e82b3053a46cd44135b15437e6f82a07b2
2021-09-07 17:29:03 +02: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
Daimona Eaytoy
38e40047e0 Apply side lock to diff headers and empty lines, too
Bug: T288676
Change-Id: Ia39df2647db3c1d010e0b84f161b369f71d7a728
2021-08-12 18:08:57 +02:00
TChin
077b9af960 Replace Assert::parameterType with typehints
Bug: T287530
Change-Id: I6060e194339614b53e3a9c036ff3a3ac2e68f8df
2021-08-03 10:03:48 -04:00
Daimona Eaytoy
9ef58c1d0b Lock selection to a single side in diffs
This is inspired by the github approach, with some adjustments,
simplifications and improvements. This approach should be supported by
all grade C browsers, except for Firefox 27-51. As such, it seems the
best solution until we can use the grid layout (T270775).

The boilerplate code for the new module was shamelessly stolen from
Ied858465c2e938828fc146880827acb6aa15fdd6.

Also noting here for posterity: this will NOT work in WMF servers (beta
or prod), since we use wikidiff2 to generate diffs there.

Bug: T285956
Change-Id: I0cb5f10254af78043b0f6250f7695c6b962fbf6b
2021-07-27 20:45:22 +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
f383e7c548 diff: Fix and update type hints in DiffOp classes
This patch adds and updates documentation. The most significant
changes are:
* getOrig() and getClosing() can return false. However, this is
  only possible for add and remove operations. These have only
  one side.
* The constructors of the subclasses are not meant to accept
  false, and are in fact never called with false. For the same
  reason. Only add and remove operations are allowed to miss
  one of the two sides.

Change-Id: I9f45f34945e0297e1ea8d3e8ff9e9c53e60e7706
2021-06-18 08:17:54 +00:00
Roman Stolar
dbe594a3ce Replace RecentChange::getPerformer with RecentChange::getPerformerIdentity
Preparing replace in core (DifferenceEngine.php, Article.php, ChangesListSpecialPage.php)

Bug: T276412
Change-Id: I4fd9cbd9404879d082179b68a9993e7203e43a8d
2021-05-27 11:45:17 +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
DannyS712
7bd7d2a6c1 Remove hooks that use Revision objects
All hooks were previously hard deprecated
in 1.35. Affected hooks:
* ArticleRevisionUndeleted - use RevisionUndeleted
* ArticleRollbackComplete - use RollbackComplete
* DiffRevisionTools - use DiffTools
* DiffViewHeader - use DifferenceEngineViewHeader
* HistoryRevisionTools - use HistoryTools
* NewRevisionFromEditComplete - use RevisionFromEditComplete
* PageContentInsertComplete - use PageSaveComplete
* PageContentSaveComplete - use PageSaveComplete
* ParserFetchTemplate - use BeforeParserFetchTemplateRevisionRecord
* RevisionInsertComplete - use RevisionRecordInserted
* TitleMoveComplete - use PageMoveComplete
* TitleMoveCompleting - use PageMoveCompleting
* UndeleteShowRevision - no replacement

Includes a fix for setting the associated rev id
of page protections, which previously was only done
using $nullRevision which was a Revision object created
if any hooks needed it; those hooks were hard deprecated
and so for WMF prod the rev id was not being set.

Bug: T247143
Depends-On: Idfa345193ae99fb2f1c9a8f8d28d8d540a6e3d62
Change-Id: I519167f76a5a3c1f5410415b2721462a3dcc3ec8
2021-04-30 17:28:20 +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
jenkins-bot
e98ae90c02 Merge "Avoid using User::getBoolOption()" 2021-03-28 02:18:21 +00:00
ZabeMath
60606a2986 Avoid using User::getBoolOption()
User::getBoolOption() is deprecated and should be replaced with UserOptionsLookup::getBoolOption()

Bug: T277600
Change-Id: Ife3c721237258d50852bbf764def74657cc70428
2021-03-27 22:51:03 +01:00
Cindy Cicalese
29862dd51d Add support for derived MCR slots
Bug: T277203
Change-Id: I1c70abc00c912b283e3e6eb2266633ae3f57673b
2021-03-18 15:34:46 -04:00
Petr Pchelko
c4f28d017b Replace some usages of User with Authority/UserIdentity
Change-Id: I7dfbf9bbd1709f5e67de7f6680a5a5ad156994fa
2021-03-04 17:20:40 -07:00
jenkins-bot
6ca4b5320c Merge "Fix error handling in TextSlotDiffRenderer::getTextDiffInternal()" 2021-03-04 10:24:03 +00:00
Petr Pchelko
ab7157e05e Convert DifferencesEngine to Authority
Change-Id: I5a4dbd2c73694b0df7e6781e7d3f7a60b91d5484
2021-03-01 13:38:58 -07: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
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
Ed Sanders
27319def63 Create diff markers with CSS
Also put <br>s into empty lines so linebreaks are preserved when copying.

Bug: T192526
Change-Id: I926bedf71562c74a0aa33fbeb11f8d1a4e4130c7
2020-12-30 12:52:08 +00:00
Ed Sanders
351077388f TableDiffFormatter: Build HTML using utility class
Change-Id: Idab793bb1aabe8bffcbb2d00f68860d8b05172ef
2020-12-29 22:24:28 +00:00
jdlrobson
ddb0c53f46 mw-warning class is replaced with warningbox
The styles can be removed as there are no caching implications here
If a skin is loading `legacy` feature or providing its own (e.g
Minerva)

Non-Wikimedia skins loading content but not legacy will lose
styling here, but that will be consistent with other message
boxes in the interface.

Bug: T269797
Change-Id: I5cfa9d83bedd2786d65d835c1f7623b7a61317c4
2020-12-09 13:27:52 -08:00
Umherirrender
692148fd62 Improve and add documentation to diff related classes
Change-Id: Ic10c700e970018fa0b9a219d96d56908b0298d71
2020-11-22 19:09:02 +00:00
Umherirrender
96cefbccfd Use existing RevisionStore in diff related context
RevisionStore includes the RevisionLookup, use the same instance

Change-Id: Ia299dae4bfb75c06ae2fca099e780ea6d2acecf5
2020-11-14 02:52:36 +01:00
Umherirrender
714c114893 Fix doc type of Diff::reverse
Change-Id: I3eb066d5effc9c96b6b9c1b3b63bdcd39790bd3a
2020-11-13 23:01:30 +01:00
Umherirrender
36b297560d Replace deprecated WikiPage::factory in DifferenceEngine
Change-Id: I2f32d9169d0bef5ed5cd433c05e2257ab7bf95f2
2020-11-11 22:36:36 +01:00
Umherirrender
d621adbcb6 build: Updating mediawiki/mediawiki-codesniffer to 32.0.0
Exclude failing sniff to fix in follow ups
Includes some simply fix, most are autofix

Change-Id: I5bb4743f08618bb6226bc2a4cc7f4d73a7ad142d
2020-10-28 20:06:22 +00:00
Thiemo Kreuz
1fc8d79ac6 Remove documentation that literally repeats the code
For example, documenting the method getUser() with "get the User
object" does not add any information that's not already there.
But I have to read the text first to understand that it doesn't
document anything that's not already obvious from the code.

Some of this is from a time when we had a PHPCS sniff that was
complaining when a line like `@param User $user` doesn't end
with some descriptive text. Some users started adding text like
`@param User $user The User` back then. Let's please remove
this.

Change-Id: I0ea8d051bc732466c73940de9259f87ffb86ce7a
2020-10-27 19:20:26 +00:00
daniel
2e57447c58 Document hook names in hook interfaces.
Bug: T258665
Change-Id: Ifddbf57f8aa2e3eb0d5845601376cbafa08ed407
2020-09-27 12:03:12 +02:00
Thiemo Kreuz
fd7363a1e1 Fix broken PHPDoc comments that don't start with /**
Change-Id: I8db56ff0f73873864dde260e51adcd729aa74e94
2020-07-23 16:09:41 +00:00
Derick A
7524d834dd diff: Remove unused DiffEngine::diff_range() private method
Change-Id: I02414b6fd87cff1efb563ad21c795b9559c2c7d8
2020-07-18 12:02:55 +00:00
jenkins-bot
a5f4732261 Merge "Replace "@stable for implementation" with "@stable to implement"" 2020-07-13 09:31:44 +00:00
jenkins-bot
39705eb311 Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00
jenkins-bot
0270990f0b Merge "Replace "@stable for calling" by "@stable to call"" 2020-07-13 09:27:04 +00:00
daniel
e6e0ad2472 Replace "@stable for implementation" with "@stable to implement"
For compliance with the new version of the table interface policy
(T255803).

This patch was created by an automated search & replace operation
on the includes/ directory.

Bug: T257789
Change-Id: I17e5e92e24c708ffc846945a136347670a3a20c7
2020-07-13 11:05:49 +02:00
daniel
3c50afa46b Replace "@stable for subclassing" with "@stable to extend"
For compliance with the new version of the table interface policy
(T255803).

This patch was created by an automated search & replace operation
on the includes/ directory.

Bug: T257789
Change-Id: Ie32c1b11b3d16ddfc0c83a757327d449ff80b2e4
2020-07-13 11:00:30 +02:00
daniel
f7116bb3a2 Replace "@stable for overriding" with "@stable to override"
For compliance with the new version of the table interface policy
(T255803).

This patch was created by an automated search & replace operation
on the includes/ directory.

Bug: T257789
Change-Id: I5ffbb91882ecce2019ab644839eab5e8fb8a1c5f
2020-07-13 10:57:12 +02:00
daniel
272db6afde Replace "@stable for calling" by "@stable to call"
For compliance with the new version of the table interface policy
(T255803).

This patch was created by an automated search & replace operation
on the includes/ directory.

Bug: T257789
Change-Id: If560596f5e1e0a3da91afc36e656e7c27f040968
2020-07-13 08:55:28 +00:00
daniel
aedc93fdb0 Mark remaining eligible classes as stable for subclassing
This classes were found by surveying concrete classes derved from base
classes in core.

Bug: T247862
Change-Id: I231752aaad26e2ab3f097301e449b31e723590f0
2020-07-10 15:02:27 +02:00
daniel
102c9573b3 Mark exceptions as @newable
Exceptions classes are nearly always value objects, and should in most
cases by newable.

Bug: T247862
Change-Id: I4faa8ec6ea8bc44086cfc8075b32d10eea61e9df
2020-07-08 17:51:38 +00:00
daniel
128565505c Mark additional classes as newable for now.
The following glasses are marked as newable per the
Stable Interface Policy, even though logically, they should not be
newable. This is done for classes that are currently instantiated
by extensions, and lack an alternative.

A better way for obtaining an instance of these classes should be
created in the future. At that point, direct instantiation should
be deprecated and replaced.

- includes/ApiMain.php - needs factory
- includes/media/BitmapMetadataHandler.php - should become a stateless service or use handler pattern
- includes/GitInfo.php - should become a stateless service
- includes/logging/LogPage.php - should become a stateless service or use command pattern
- includes/logging/ManualLogEntry.php - should become a stateless service or use command pattern
- includes/poolcounter/PoolCounterWorkViaCallback.php - needs a factory
- includes/context/RequestContext.php - needs to be narrowed down, and should use a factory
- includes/search/SearchHighlighter.php - should have a factory
- includes/TitleArrayFromResult.php - should perhaps be part of TitleFactory
- includes/user/User.php - should at least get a factory method for anons
- includes/diff/Diff.php: needs a TextDiffGenerator service or a factory
- includes/EditPage.php: needs a factory

Bug: T247862
Change-Id: I033158e693c98630ee167d9528fc8c9936f978d4
2020-07-08 18:06:12 +02:00
DannyS712
fe201ad436 Don't create Revisions for deprecated hooks if hook is not registered
Once the Revision class is hard deprecated, we will still need to
run hooks that use Revision objects; even though the hooks will be
deprecated, Revision objects still need to be created for them.

To ensure that deprecation warnings aren't triggered by creating
Revision objects in deployed code, for deprecated hooks only
create the Revision object if the hook is registered.

All hooks that pass Revision objects have already been hard deprecated.

Bug: T246284
Change-Id: I7e718551822825cd390662bb201dd13e2e527e8b
2020-07-01 03:44:36 +00:00