Commit graph

626 commits

Author SHA1 Message Date
Matěj Suchánek
02389446a5 ChangesList: Cache user links
Follow up to a468534. The caching added to RCCacheEntryFactory
would be utilized only by EnhancedChangesList. This should
improve performance for OldChangesList, too.

Bug: T341319
Change-Id: Ibb1907732c71d0783d1a627063debb2a484cafe7
2023-08-20 16:55:58 +02:00
jenkins-bot
dc412f3bb5 Merge "Cache some more repeated messages in changes lists" 2023-08-19 19:31:29 +00:00
Matěj Suchánek
cfad5d8d71 Cache some more repeated messages in changes lists
Change-Id: I635eaf947280fd1071e308b19715d581e1c1cb15
2023-08-19 14:32:58 +02:00
Amir Sarabadani
15a278189f Reorg: Move MWTimestamp to MediaWiki\Utils
Bug: T321882
Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
2023-08-19 05:53:40 +02:00
Matěj Suchánek
f3b25b3891 ChangesList: Call MapCacheLRU::makeKey
Also split the cache by context, like it's done
in ::insertTags. Follows-up 17deb8353b (I0b5e48ef5).

Change-Id: I5b539a63c3210a8cd1debb2ba625b0f2dedacc39
2023-08-16 03:31:00 +00:00
jenkins-bot
a8d3383444 Merge "Mass migrate Database::insert calls to InsertQueryBuilder" 2023-08-08 11:01:32 +00:00
Amir Sarabadani
98d6503f65 Mass migrate Database::insert calls to InsertQueryBuilder
Done automatically based on a php parser written on top of ANTLR4

Bug: T335377
Change-Id: Ie8fabc594edab18e55cb1d5bbf573762106e3d71
2023-08-07 19:44:27 +02:00
Timo Tijhof
17deb8353b objectcache: Add MapCacheLRU::makeKey() and adopt in ChangesList
This came up during code review of change I91588aebae7e49e3d3c.

Change-Id: I0b5e48ef52513f012bfbb460ab5a649178ebf255
2023-08-03 17:19:33 +00:00
thiemowmde
ef84619cd3 Consistently use LogicException for test-only methods
"BadMethodCallException" sounds like it would fit, but it does
have a very different meaning, described as "exception thrown if
a callback refers to an undefined method or if some arguments are
missing". This is not what's going on here. These are methods that
should only be called from unit tests.

This appears to be a common mistake, often copy-pasted.

Change-Id: Ib39e28f596a883481d5f526460a5c871c75f5313
2023-07-22 16:21:42 +00:00
jenkins-bot
0fadd34392 Merge "RecentChanges: Add process caching to RecentChanges UserLinks and Tags parsing" 2023-07-20 01:32:58 +00:00
ttomalak
a468534689 RecentChanges: Add process caching to RecentChanges UserLinks and Tags parsing
Rendering UserLinks or Tags requires parsing, which when run on thousands of records, adds up to a significant amount of processing time. More often than not, this can be optimized by storing already visited tags or user links as those "renders" will not change for the single request run and are repeated constantly on the list.

Bug: T341319
Change-Id: I91588aebae7e49e3d3cb77702cf28677b4a14c8d
2023-07-18 12:05:33 +02:00
Fomafix
9bf98ab9db EnhancedChangesList: Use HTML/CSS for collapsing
The collapsing on the enhanced changes list now works without
JavaScript.

Keyboard navigation is still supported but only the space and not the
return toggles the collapsing toggle button.

The <input type="checkbox"> element needs an unique identifier in the
`id` attribute and the same value must be in the `for` attribute of the
<label> element. A simple counter in the class EnhancedChangesList
starts twice from the beginning if the recent changes get included as:

 {{Special:RecentChanges|enhanced=1}}
 {{Special:RecentChanges|enhanced=1}}

Therefore a random value is used as checkbox identifier.

The module 'jquery.makeCollapsible' and its classes `mw-collapsible`,
`mw-collapsed` and `mw-collapsible-toggle-collapsed` are not needed
anymore.

The icons from module 'mediawiki.icon' are directly included because the
module has fixed selectors which do not fit here.

Bug: T172618
Change-Id: Iafd27e5d760b78ae386d833946005f86cee8dd64
2023-07-13 23:12:45 +00:00
Umherirrender
1086958611 Replace array_keys in foreach to use $_ as value instead
When the value of the associated array is not used, there is no need to
use array_keys and create internal a copy of the array, just omit the
value with $_ to tell static analyzer that the var is unused.

Change-Id: I5c6d667e98c0167c0573c683f0d617bc1d4ca619
2023-07-10 02:53:52 +00:00
thiemowmde
990ef704ce Collapse sequences of if into short return if possible
The main goal is to make this code faster and easier to read, and to
avoid duplication.

Change-Id: I925d742d560e9d90e3ecc9ff19fe7e87b60bf9a4
2023-06-15 15:14:40 +02:00
Daimona Eaytoy
518a5da533 Replace deprecated MWException
Bug: T328220
Change-Id: I0408575ee71e58d1c9e9ebedabab35bd3813f515
2023-06-12 12:27:49 +00:00
Daimona Eaytoy
8adf1bfb93 Replace some more usages of deprecated MWException
Bug: T328220
Change-Id: I3c36835fbd90acc301731e2b33ae4815cd4b0cc5
2023-06-09 02:07:08 +02:00
Amir Sarabadani
b55c501fe0 Migrate Database::update() to UpdateQueryBuilder
I did this using a script written on top of antlr4 parser so it doesn't
have some clean ups a human would do but it's pretty nice already.

Bug: T330640
Change-Id: I608566700c6d737ee986bf47dda87effc69614d6
2023-06-08 12:34:20 +02:00
Timo Tijhof
34dc4e6d26 rcfeed: Add 'notify_url' and 'title_url' to MachineReadableRCFeedFormatter
* Move the current URL logic from IRCColourfulRCFeedFormatter
  to a new method RecentChange::getNotifyUrl (covered by tests now).

* Re-use this method in MachineReadableRCFeedFormatter so that
  the diff/patrol/rcid etc URL is also available in the modern
  JSON-based EventStreams service. And in particular to allow
  porting of the legacy irc.wikimedia.org backend to a much simpler
  one that is based on this.

* Also expose a title_url field which was previously missing,
  and made consumption of the data needlessly difficult.

Bug: T234234
Depends-On: Id740134ef30b2276688d7b7caedb6bb652158761
Change-Id: Ic3e0aebdb61b5c0e5fbed08656db4a1e90b67518
2023-05-19 15:48:40 +03:00
Umherirrender
e04d3a28f6 Replace internal Hooks::runner
The Hooks class contains deprecated functions and the whole class is
going to get removed, so remove the convenience function and inline the
code.

Bug: T335536
Change-Id: I8ef3468a64a0199996f26ef293543fcacdf2797f
2023-05-11 06:17:38 +00:00
Matěj Suchánek
cb0e04086f EnhancedChangesList: Make format of categorization entries consistent
Make this subroutine same as that in ::recentChangesBlockLine.
This solves the illogical issue where diff links would be displayed
only for ungrouped categorization entries, but not within groups
of them, making such entries useless for patrolling.

Bug: T270662
Change-Id: Ib4f02673cb47b42fcb1c2268691ca41cd637b0c5
2023-04-04 19:29:53 +00:00
Tim Starling
580ec48e5b Fix more PHPStorm inspections (#2)
* Illegal string offset and invalid argument supplied to foreach, due to incorrect type information
* Array internal pointer reset is unnecessary
* $hookData unused since MW 1.35 due to incomplete revert
* array_push() with single element
* Unnecessary sprintf()
* for loop can be replaced with str_repeat()
* preg_replace() can be replaced with rtrim()
* array_values() call is redundant
* Unnecessary cast to string
* Unnecessary ternary. Often the result relies on short-circuit evaluation, but I find it more readable nonetheless.

Change-Id: I4c45bdb59b51b243fa96286bec8b58deb097d707
2023-03-25 00:19:58 +00:00
Matěj Suchánek
94d080d305 Allow marking recent changes about logged actions with bot flag
There was no clean way to do this but using the global state.

The parameter is three-state to keep backward compatibility.

Bug: T304428
Change-Id: I01c5f8e9646cbe861516100c3b8d165aefb95ca0
2023-03-13 01:59:35 +01:00
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
jenkins-bot
d8c6abed40 Merge "EnhancedChangesList: Fix curid for permalinks" 2023-03-01 20:46:49 +00:00
Matěj Suchánek
8728fd9a61 EnhancedChangesList: Fix curid for permalinks
The code assumed that curid is same for all changes in the block
(more precisely, the first one applies to all others).
This is not true when the block includes categorization changes.

Refactor the code to prefer individual link params instead of
global approach.

Bug: T270774
Change-Id: Id2286392239b67a44fbb2e95346daad9fc2a0e4f
2023-02-26 17:33:49 +01:00
Matěj Suchánek
b31b6b6241 RCCacheEntryFactory: Don't make a "cur" link for newest revision
Bug: T34038
Change-Id: I94d63d708b5ef0ed15dcb2c4a5bff4d2300625f0
2023-02-26 16:32:09 +00:00
Matěj Suchánek
fba807c3ca EnhancedChangesList: Isolate categorization entries in getLogText
rc_this_oldid and rc_last_oldid of categorization entries
reference revisions of the page that had its categorization
changed rather than the category page itself. These should
not be considered when building the diff link(s).

Introduce new aggregate variable $allCategorization and use
it instead of examining $rcObj (which deals only with the last
change in the block).

Finally, drop the ::userCan check deciding whether the user
can see the diff. It wouldn't work properly either, because
it would check only the last (oldest) entry in the block, not
the first (newest) and the one before the last.

Bug: T261068
Change-Id: I10bdfbad9d8a36f210ffd11a832604104f8ecdc5
2023-02-26 15:54:02 +00:00
jenkins-bot
460f615e4c Merge "EnhancedChangesList: Rewrite bogus condition" 2023-02-26 15:07:42 +00:00
Matěj Suchánek
cae04c8138 EnhancedChangesList: Rewrite bogus condition
It was definitely already wrong when it was added in 2008
(r33013). !$type will return true for RC_EDIT (!0), false for
all other types (RC_NEW, RC_LOG, etc.). The weak equality
comparison then casts RC_LOG to boolean (3 -> true).
So the first condition will pass if and only if $type is
RC_EDIT.

As this piece of code lasted for 15 years and there
seems to be no objection to the behavior, I just
rewrite it to make it more clear and keep the same
behavior.

Cudos to Thiemo Kreuz who disassembled the code.

Change-Id: I93f853b2a191fc3011b47fcd1ac22ac649ce541a
2023-02-26 10:05:48 +01:00
Matěj Suchánek
132a4b75a1 EnhancedChangesList: Consistent order of link attributes
Keep action=history after curid=, like was done in 39783472b.
Follows up I1aa3be64f9b4e9c63cb72037b131361616f76292.

Change-Id: Ie319052754c910857adca370e1d7c8b8ff9d7618
2023-02-25 11:40:23 +01:00
jenkins-bot
9a96857757 Merge "Reorg: Move HTML-related classes out of includes/ to Html/" 2023-02-21 15:37:53 +00:00
jenkins-bot
cb3a7ed7b2 Merge "Clean up EnhancedChangesList::getLogText" 2023-02-18 23:38:20 +00:00
Amir Sarabadani
7d8768e931 Reorg: Move HTML-related classes out of includes/ to Html/
Bug: T321882
Change-Id: I5dc1f7e9c303cd3f5b9dd7010d6bb470d8400a18
2023-02-16 20:40:01 +01:00
Matěj Suchánek
7cbebaeb8a Simplify RCCacheEntryFactory::buildCLink
This branch has the identical output as the default one.
There is probably no reason for unpatrolled new pages
to be handled separately (and skip check for special pages).

Change-Id: I1f2f2dcc6fe9f6b4a6b2f6d920adb6eede5fdc1f
2023-02-16 18:56:17 +01:00
Matěj Suchánek
e21ab231c5 Clean up EnhancedChangesList::getLogText
No functional changes, pure refactoring.
- Merge two loops over the same array.
- Move "enhancedrc-since-last-visit" message generation
  where it actually is needed. This should save a bit of time.
- Store the title in a variable.
- New-style comments.

Change-Id: I1aa3be64f9b4e9c63cb72037b131361616f76292
2023-02-16 18:06:40 +01:00
thiemowmde
bf90007dec Use the ?? operator in a few places where it makes sense
… and where it improves readability, in my opinion.

Change-Id: I4f3bc6067dfac16841ed74c00a4c81215d0f5249
2023-02-14 09:44:27 +01:00
jenkins-bot
7fa4474049 Merge "OldChangesList: Pass revision ID through to user link" 2023-02-07 10:03:16 +00:00
Timo Tijhof
b765222915 watchlist: Re-centralise former wgUseEnotif condition
Follows-up I9bfa502a0b (9b8f153f). Also document the reason for
this logic, to the best of my knowledge, and some ideas to improve
it.

Bug: T305093
Change-Id: I4c5bf4d4da83ff1e03d0fe0dd9891507b1f1e455
2023-02-02 08:48:50 +00:00
Matěj Suchánek
03fe1078cf Select recent changes for deletion only by page id
The problem this patch fixes:

- Step 1: Move an existing page A to a new title B.
- Step 2: Delete the redirect at the old title A.
- What happened: All the edits made to the page prior to the move
  are gone from recent changes.
- What should have happened: all the edits made to the page prior
  to the move are still in recent changes under the (now redlinked)
  title A.

Contrary to that, moving a page with redirect suppression would
preserve the changes.

Bug: T140960
Bug: T307865
Change-Id: Ib52a9c657620275388012a778bc9d839dd740624
2023-02-01 10:40:30 +00:00
Thalia
3ed0dfcf80 OldChangesList: Pass revision ID through to user link
Bug: T326396
Change-Id: I09a407f24572312c9ec2ce9653ebbf28ea7819c1
2023-01-30 17:11:25 +00:00
Thalia
5fc40443ce EnhancedChangesList: Add latest revision ID to top level user link
Bug: T326395
Bug: T326396
Change-Id: Ia3966f59c271e3c9826c170ffb580715f4ee5a35
2023-01-30 16:22:50 +00:00
STran
895163441a Add revision id to recent changes entry
Bug: T326395, T326396
Depends-On: I6b98a2f9a59922eb923bad8c39cad05514b5fc66
Change-Id: If70d610c98fb56d957d947a61310064afef2c367
2023-01-26 16:30:17 -08:00
Daimona Eaytoy
3af20152cd Replace more usages of MWException
Bug: T86704
Change-Id: I14abf71b7dcf432d0eb35f0b4ab2fa4fb797e2e8
2023-01-26 10:38:16 +00:00
Nardog
39783472ba Make history URL for category change consistent with other history links
I9cae1afa made the order of 'curid=...' and 'action=history' in the
history links for category changes inconsistent with other history links
on the changeslist.

Bug: T264491
Change-Id: I311c375d9250ab8a92bcf8e0b79af9e075487f96
2023-01-12 11:37:49 +09:00
Derick Alangi
8eb423c4dc Use CommentStore service instead of deprecated method
Also, added a parameters to XmlDumpWriter so that they could be
inject via WikiExporter.

Bug: T325475
Change-Id: I84b82506509e2c09dad0691af2df958a5af5b5b0
2023-01-04 23:50:51 +00:00
Alexander Vorwerk
f6bd18d6c2 Split a base class out of CommentStore
so that extensions (i.e. CheckUser) can implement their own comment
store without having a lot of code duplication

basically the comment store version of I3a6486532f2ef36

Bug: T233004
Change-Id: Ib40f99e00a514d41776ce521baf113e46d37e9cd
2023-01-01 22:34:36 +00:00
thiemowmde
8b49357b25 Replace some tivial ??= with even more trivial ??
Patch Ifa7a9bc replaced some longer `=== null` constructs with the
new ??= operator we have since PHP 7.4. However, some of these can be
simplified even more with the ?? operator we have since PHP 7.0.

Follow-Up: Ifa7a9bc7b2ec415ad7ecb23f4c1776f51f58fd6b
Change-Id: I7b05e723810558bb5437adc97eab54ca04d38c06
2022-12-23 08:35:44 +01:00
Gergő Tisza
20d7a519ec
Fix history pager tools
Follows up Ia03038e86c6a607c8b75eefedbf0285ca1a2f8c8.

* Only generate a rollback link for the latest revisions in
  ContribsPager.
* Gate the entire ChangesList::insertPageTools beind the RC
  attribs check, not just the rollback link generation.
* In ContribsPager::formatRow, check for the existence of $page in
  a more reasonable place. This was already broken before Ia03038e
  so I suspect $page is never null in practice (in theory, a
  ContribsPager__reallyDoQuery hook handler could somehow produce
  a $row with no title information), but it can't hurt.
* Add some documentation and FIXMEs.
* Remove a comment from ChangesList - part of it is not true
  anymore after Ia03038e, part of it already didn't make sense
  before that.

Bug: T51541
Bug: T325753
Change-Id: If848e38b568492579382a2c920cb865fb0326d99
2022-12-22 14:36:14 -08:00
DannyS712
c1db64b808 Make use of ??= in more places
New feature from PHP 7.4

Change-Id: Ifa7a9bc7b2ec415ad7ecb23f4c1776f51f58fd6b
2022-12-17 01:10:13 +00:00
jenkins-bot
c903124b77 Merge "Make use of ?:, ?? and ??= operators in mostly trivial cases" 2022-12-16 02:51:26 +00:00
Jon Robson
012a387587 Generalize History pager tools for use in other contexts
The history page renders an extensible list of tools for each
change list row. I've factored this code out so that it
can also be used on other pages that use the Pager class.

This generalizes the logic for the rollback link and makes sure
the control is standardized across pages. It also allows
the onHistoryTools hook run. I suggest we rename this to something
more generic in a follow up.

Right now usages of onHistoryTools are low but there should be
no issues with running it on more than the history page. One of
the benefits of this is the thanks link will now show on the
contributions page, watchlist and recent changes.

Bug: T51541
Change-Id: Ia03038e86c6a607c8b75eefedbf0285ca1a2f8c8
2022-12-15 14:44:18 -08:00
Matěj Suchánek
a592d47e91 Clean up redundant array manipulation
PHP does this implicitly.

Change-Id: I009a7c93d44fb5e8c430c971cfc637fa04a8e68d
2022-12-11 12:42:29 +01:00
jenkins-bot
986bf285ec Merge "Suppress RecentChange::doMarkPatrolled when autopatrol is requested" 2022-12-09 19:46:00 +00:00
Amir Sarabadani
2d60ba0c63 Reorg: Move DummyLinker and Linker to linker/
This feels like a no-brainer unless I'm missing something obvious

Bug: T321882
Change-Id: Id49c3d0dd6ea4593211048850856b5b8e05a8fb3
2022-12-08 06:38:17 +01:00
thiemowmde
70aa9c8e35 Make use of ?:, ?? and ??= operators in mostly trivial cases
The motivation is to make the code less confusing. I hope this is the
case.

?? is an older PHP 7.0 feature.
??= was added in PHP 7.4, which we can finally use.

Change-Id: Id807affa52bd1151a74c064623b41d950a389560
2022-12-05 21:37:13 +01:00
Matěj Suchánek
fa045ecdde Suppress RecentChange::doMarkPatrolled when autopatrol is requested
The result of the method has been inappropriate and
surprising since rc_patrolled was changed to distinguish
between manually patrolled and autopatrolled changes
(T184791).

When called with $auto = true, it would mark the change
as manually patrolled (not autopatrolled), but it would
not log it as such in patrol log and would still require
'autopatrol' right (not 'patrol').

Change-Id: I0bd6f2cf317d2b1c8dd50b7998724a57f5f549fb
2022-12-03 17:16:50 +00:00
Tim Starling
0077c5da15 Use short array destructuring instead of list()
Introduced in PHP 7.1. Because it's shorter and looks nice.

I used regex replacement.

Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
2022-10-21 15:33:37 +11:00
Amir Sarabadani
f8bf3687f4 Feed: Move feed-related classes to Feed/ and namespace them
Bug: T166010
Change-Id: Icdbe003e74d2f31b68b575acfa94c09c24d7aed5
2022-10-20 17:25:49 +00:00
Umherirrender
5c5498a202 Remove unused key variable from foreach loops
Change-Id: Id2d91e30a6f7cc4eb93427b50efc1c5c77f14b75
2022-09-21 21:18:43 +02:00
Brian Wolff
6bbdd06080 Coalesce rc comment field to empty string if null
Follow up to I14c6c22d822ae4

Fixes a warning on php 8.1 where the comment on log entries
might be null.

Change-Id: If0e41f0696a24a56f112e05c46a9a7fdbfaa3aaa
2022-09-12 19:13:43 -07:00
Umherirrender
9b8f153fb8 Setup: Remove internal short-cut config $wgUseEnotif
It is not possible to set $wgUseEnotif on LocalSettings.php,
because it is always set on setup, it should not be a global/setting.
Just remove it from the dynamic setup and use the config it is set from

Bug: T305093
Change-Id: I9bfa502a0b9798bd149b4cfe4db86a0461e76f55
2022-08-17 23:41:30 +02:00
jenkins-bot
ef650d66d8 Merge "Improve docs of various ::getQueryInfo functions" 2022-08-14 07:40:47 +00:00
Umherirrender
cbe949410d Improve docs of various ::getQueryInfo functions
Explict types helps phan to detect errors with keys like ef82d95

Change-Id: Iee4d964ecc58273eb9c73356ed34e13f29fbd275
2022-08-13 21:18:44 +02:00
Thiemo Kreuz
c490bec348 Use native array_column() in ChangesListFilter code
Change-Id: I9d0b95ebc8c37380b5a1f2ac2eb8e55b6707e1e6
2022-08-08 07:21:31 +00:00
STran
d35ac50fd4 Add revid to category changes
Pass along a revid to category changes on Special:RecentChanges
This change allows IPInfo downstream to pull the revid for use in
its subsequent API call

Bug: T310813
Change-Id: I533d5fffd64dc741d5b28563f9e0c0827a48906c
2022-07-27 21:32:42 -07:00
Umherirrender
7f08635b13 recentchanges: Remove special handling of rc_ip for postgres
The special type of the column was changed in 6809067

Change-Id: I308df77f3ab39ddddf6219e6c292ab50ec4bbc22
2022-07-16 12:30:57 +02:00
Amir Sarabadani
f24eb94571 RecentChange: Make join to comment table also straight
The optimizer is refusing to pick the right join order

Bug: T311360
Change-Id: I742201b45975a5edcac5d4634d70d50ee851f0ac
2022-06-30 23:38:30 +02:00
Amir Sarabadani
478d604216 RecentChange: Straight join to actor table when needed
It should avoid using straight join when there is a condition on the
actor table which potentionally could make the query faster.

Bug: T311360
Change-Id: Iad3d0cf2479c560be255f85d8896f37efae606c5
2022-06-30 18:17:38 +02:00
diesel kapasule
e908b23627 Adding log links for deletion and protection to ChangesList
Add action links for deletion and protection on Changeslist.php.
This will make links more consistent with the log page entries.

Bug: T49466
Change-Id: Ic1fdb2b4280bdeac521323aafe4548819778c870
2022-06-01 09:56:45 +00:00
Umherirrender
1af94959bf changes: Replace deprecated User::getOption
Bug: T296083
Change-Id: I6744ed237fb30aec5540eb68140ab6f8c5d71246
2022-04-29 21:51:20 +02:00
Aryeh Gregor
666ca1bdf3 Use MainConfigNames instead of string literals, #2
This covers all occurrences of /onfig->.*get( '/ in includes/.
Undoubtedly there are still plenty more to go.

Change-Id: I33196c4153437778496f40436bcde399638ac361
2022-04-13 18:55:46 +03:00
Umherirrender
801cac9ec7 Add mw-history-suppressed for userlink also on enhanced Watchlist
Follow-Up: I08f14f712479e1b170c606e2b64857f8386acd76
Change-Id: I63b6f484bf498a9bbe574eaac66f89b4e045c0e2
2022-04-11 20:35:14 +00:00
Aryeh Gregor
747bc81ac0 Use MainConfigNames instead of string literals
Part 1, proof of concept. Hundreds of files left to go. These changes
brought to you in large part by vim macros.

Bug: T305805
Change-Id: I44789091e9f6394c800a11b29f22528c8dcacf71
2022-04-11 17:53:27 +03:00
jenkins-bot
db6e246d03 Merge "changes: Replace deprecated User::newFromName() to ::newSystemUser()" 2022-04-02 11:21:18 +00:00
Umherirrender
7aa0884029 phan: Remove PhanTypePossiblyInvalidDimOffset suppression
Make phan stricter about array keys
Remaining false positive issues are suppressed.
The suppression and the setting change can only be done together

Bug: T304887
Depends-On: I3105a5fd4826f8667b5232834defc5ec93be32a1
Depends-On: Ie9610a6e83731468311edb3ed17f80fc509de385
Change-Id: I701f12ab94478c3b8e7fd82110ade74a8e6b04ef
2022-03-28 23:26:49 +02:00
Derick Alangi
7bdb64214b
changes: Replace deprecated User::newFromName() to ::newSystemUser()
Change-Id: I65add7ed5e9aa95d1a626faaff05b94154ddf027
2022-03-21 19:37:59 +01:00
Umherirrender
d30b3d8926 Fix various documentation related to scalar types
Found by phan strict checks

Change-Id: If41d16b473baddd92cc4261cdc2bfbe65fedcb19
2022-03-09 20:49:51 +00:00
Timo Tijhof
f8ecea1e5c rcfeed: Deprecate $wgRCEngines and RCFeedEngine
Follows-up 39a6e3dc4d (I8be497c623c5d92).

* Improve documentation all around and advertise 'class'
  everywhere instead of 'uri'.

* Add test coverage for RCFeed::factory().

* Deprecate the $wgRCEngines "uri to class" mapping in favour
  of specifying "class" directly in $wgRCFeeds.

* Deprecate RCFeedEngine in favour of FormattedRCFeed.
  Convert to class_alias so that UDPRCFeedEngine no longer has
  to extend the deprecated class name explicitly (for instanceof compat).

* Hard-deprecate RecentChange::getEngine.

Bug: T250628
Depends-On: Ie939e1d06b9ee2d841ec7256c8d24cc4e7e386dd
Change-Id: Ib6758d724c7200404c89c7ab157aa55f1cad9763
2022-03-08 19:50:19 +00:00
Reedy
86934b2fa8 Replace some more usages of Wikimedia\(suppress|restore)Warnings()
Change-Id: I2eb133a9e32116cd155f59086245bc4d15ecbfcc
2022-02-24 20:27:46 +00:00
C. Scott Ananian
9e033de4f2 Don't double-escape the ellipses in Language::truncateForVisual()
It turns out this gets rid of a bunch of suppressed
"SecurityCheck-DoubleEscaped" that appear to have been accurate
warnings.

There seems to have been some confusion about how ::truncateForVisual()
is supposed to be used; in particular it is to be passed *unescaped*
output, because it is not (generally speaking) safe to truncate
HTML-escaped strings.  The goal of ::truncateForVisual() is to have
a specific number of codepoints in the output for display purposes,
the encoding of those codepoints is not an issue (htmlspecialchars
can be applied to the *return value*.)  If you need a specific number
of *bytes* you should be using ::truncateForDatabase().  If you want
a certain number of *HTML bytes* then the ::truncateHtml() method
is probably what you want.

Slightly refactor some code in RevDelLogItem to avoid a false positive.

Bug: T301205
Bug: T290624
Change-Id: I893362e049aedfa699043fcf27caf4815196f748
2022-02-10 17:09:18 -05:00
Umherirrender
68808e5832 Replace deprecated JobQueueGroup::singleton()
Change-Id: Icdb301d352d302f70fefba9b40df2368cb217fd2
2022-01-27 21:37:50 +01:00
Jon Robson
6c67798d6c [ChangesList] Time element in ChangesList should be consistently named
Follow up to I0cba011f0ab8cb8fd59962b5eafb7650deefe841

This class is usually used for dates.
In Special:Contributions an additional class is used for times
so let's use that here.

This will be helpful for T219349

Change-Id: Ibd5cff5cc37bec8eb840d7f0479fcb4eb8346611
2022-01-20 22:28:21 +00:00
Umherirrender
95852cb22b Explicit cast TS_UNIX to int for arithmetic operations and int args
When the called function has a doc of int, it should be cast to be
explicit here.
Also cast for arithmetic operations to be explicit about the number

Change-Id: I905b78dfb66e66443e0e3203488bab5b548db543
2022-01-11 20:13:13 +01:00
jenkins-bot
0f062d1803 Merge "ChangesList: Add .mw-changeslist-time (no date) to output to each row" 2022-01-10 23:40:14 +00:00
jdlrobson
be86676347 ChangesList: Add .mw-changeslist-time (no date) to output to each row
Bug: T298639
Change-Id: I0cba011f0ab8cb8fd59962b5eafb7650deefe841
2022-01-10 23:19:40 +00:00
TChin
47adb6d65a Refactor global variables to use MediaWikiServices instead
Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI.

Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228

* This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it.

A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki

Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
2022-01-10 13:55:53 -05:00
Siddharth VP
191cadb6a5 Fix typos in comments (C-D)
Change-Id: I568fb93b53feb83f026d485136dd0d116d677f4f
2021-12-30 18:00:02 +05:30
jenkins-bot
44ad8cfb23 Merge "Call static ChangesList::isDeleted statically" 2021-12-17 16:42:35 +00:00
Thiemo Kreuz
b4c63c64ae Remove some more comments that literally repeat the code
Nothing to learn from these.

You can find a longer explanation in the comments in I93751e6.

Change-Id: I195aae70fc282b58be5b18160783f27d38605d15
2021-12-09 19:01:36 +01:00
Umherirrender
e056134711 Call static ChangesList::isDeleted statically
Using static:: and not self::,
because subclass EnhancedChangesList already calling it that way

Change-Id: Ibc57bf9bbfdb86a0fe6a7dd18e9ff730b882dab5
2021-12-05 01:23:46 +01:00
Amir Sarabadani
9bcd3fdfa5 Remove ActionAjax
Bug: T42786
Change-Id: I8bda0c281e1f4abbffbddb80ac74a6d61a034d28
2021-12-01 22:31:30 +01:00
Umherirrender
bb8d3e0d68 Fix missing history-deleted class for suppressed revision on changeslist
For comment and content the class mw-history-suppressed is added
additional, should be the same for the user.

Follow-Up: I08f14f712479e1b170c606e2b64857f8386acd76
Change-Id: I7d477913952b9cc67314d1ec96f83db2846a74cb
2021-11-27 23:49:12 +01:00
Reedy
2a2bb1e9bd Remove or replace usages of "sane"
Bug: T254646
Change-Id: I096b2cf738a1395a14f1d47bcbed0c2c686c2581
2021-11-22 13:35:17 +00:00
vladshapik
9b92c1088f Drop User methods which were deprecated since 1.35
The following User methods, deprecated in 1.35, have been removed:
  - ::isIP,
  - ::isIPRange,
  - ::isValidUserName,
  - ::isUsableName,
  - ::isCreatableName,
  - ::getCanonicalName,
  - ::addAutopromoteOnceGroups,
  - ::getDefaultOptions,
  - ::getDefaultOption,
  - ::getOptions,
  - ::getBoolOption,
  - ::getIntOption,
  - ::setOption
  - ::listOptionKinds
  - ::getOptionKinds,
  - ::resetOptions,
  - ::getEffectiveGroups,
  - ::getAutomaticGroups,
  - ::getFormerGroups
User::GETOPTIONS_EXCLUDE_DEFAULTS has been removed, since it is used only in the description of User::getOptions.

Bug: T277511
Depends-On: Ida05c22f81b30d9b46678e8ede3d531c38855d83
Change-Id: I72bbc2336f8ddbc66ce67226cd2d5baaa2f807d8
2021-11-12 15:35:50 +02:00
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