Commit graph

794 commits

Author SHA1 Message Date
Pppery
65d32263fd Diffs: avoid getContentHandler on null error
Bug: T388708
Change-Id: I4dbbeb70a53c6ca0b3c44995d13e2c5de097ddf2
(cherry picked from commit 7aee965efdbe316f8ea13b1d03b4c1afab11d255)
2025-04-10 21:37:29 +00:00
Umherirrender
1b29f07440 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I73fb416573f5af600e529d224b5beb5d2e3d27d3
2024-10-21 20:41:20 +02:00
C. Scott Ananian
d6d6343c68 Deprecate OutputPage::{get,set}PreventClickjacking()
This is redundant with the same-named methods on ParserOutput.

Bug: T301020
Change-Id: I60455186e3a6e9b4329ff09e2f7ea920e2e05192
2024-10-17 23:51:39 -04:00
Umherirrender
e662614f95 Use explicit nullable type on parameter arguments
Implicitly marking parameter $... as nullable is deprecated in php8.4,
the explicit nullable type must be used instead

Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a

Break one long line in SpecialPage.php

Bug: T376276
Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
2024-10-16 20:58:33 +02:00
James D. Forrester
cc28acc455 Add namespace to remaining parts of Wikimedia\Mime and Wikimedia\Stats
Bug: T353458
Change-Id: If0137003ab625017d322d57870448a02569668c3
2024-09-27 16:19:10 -04:00
Umherirrender
ca8b1eb476 Add missing documentation to class properties (frontend-related)
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: Id75cb2e5fbee0fe7600f92473d876f23730d46b7
2024-09-05 21:41:19 +02:00
James D. Forrester
bc662aec9b Move Language and friends into Language namespace
Bug: T353458
Change-Id: Id3202c0c4f4a2043bf97b7caee081acab684155c
2024-08-10 13:36:30 +02:00
Reedy
b52a8addf5 Drop writeapi userright
Bug: T294397
Depends-On: Ib34228a18917e404517d45e539bd786419d9c401
Change-Id: Ifad2edc782b36d21c8c67fecde7f011dce02c11b
2024-07-31 11:10:50 +00:00
Cole White
89a10817dc diff: migrate TextSlotDiffRenderer to use StatsFactory
Bug: T359241
Change-Id: I4f443b004b9ed77b9e6b8b1144d0cc2847a55d16
2024-06-28 19:29:31 +00:00
jenkins-bot
0a33bd66e2 Merge "Use namespaced classes (1)" 2024-06-18 19:32:48 +00:00
Umherirrender
9879723ef3 Use namespaced classes (1)
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: Ic4d4dd61de5ab896fb6173eb579c81f164a1e4a3
2024-06-16 20:18:23 +02:00
Timo Tijhof
b170672dc7 diff: Mark TextSlotDiffRenderer DI setters as @internal
For use by I4f443b004b9ed7 (T359241).

Change-Id: If6acfb4fbb041dc13c7b4ccfaae4abd6f5b9b550
2024-06-15 00:01:38 +01:00
jenkins-bot
5a74e8a7b6 Merge "Add namespace and deprecation alias to TextContent" 2024-05-20 00:47:30 +00:00
Ebrahim Byagowi
b5727d94b5 Import InvalidArgumentException at top of the source
It was asked in a patch review to apply fully import
InvalidArgumentException where possible. I was guessing some
of my other already merged patches have but turned out such
thing exists other places style so for the sake of consistency
I've turned rest of inline import of the specific exception at
top of the file.

There are instances of source files that aren't in any namespace but
have fully qualified import which this patch doesn't touch.

Change-Id: I4071fc698b65746d9594cf4d5f45bae82843d436
2024-05-19 23:57:44 +03:30
Ebrahim Byagowi
97d1202784 Add namespace and deprecation alias to TextContent
This patch introduces a namespace declaration for the
MediaWiki\Content to TextContent and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Ic251b1ddfcf6db9c85cb54cddf912aa827d2bc3a
2024-05-19 23:23:01 +03:30
jenkins-bot
bc11d8072a Merge "Metrics: Migrate MediaWiki.diff_cache.* to statslib" 2024-05-10 09:50:06 +00:00
Hakan Özdemir
6c5684d41f Add namespace and deprecation alias to DeprecationHelper
This patch introduces a namespace declaration for the
MediaWiki\Debug to DeprecationHelper and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I808c6aa7836445feaa7b401624d79d01f2c70322
2024-05-05 14:16:35 +02:00
Larissa Gaulia
f340a72428 Metrics: Migrate MediaWiki.diff_cache.* to statslib
Bug: T359240
Change-Id: Iec49ddac0f7b24ad45b7a25e5832c91f5ee55214
2024-05-04 15:46:32 +02:00
Jon Robson
c3c4920c70 Always show patrol link regardless of whether in diff-only mode
Bug: T357693
Change-Id: I93736bd8ca4cc69cb89023d83872dcc3d71694a5
2024-02-22 16:10:37 -08:00
Sam Wilson
3e1c6b74f5 diff: Change order of inline diff legend elements
To match the order that's used within the diff (deleted followed
by inserted).

Bug: T357150
Change-Id: I80dd954e8bfb699280dcf5791cc16e153b291e17
2024-02-15 12:59:19 +08:00
Jon Robson
98d2853581 Diffs: Always render patrol link in HTML and hide via CSS
The mobile site has traditionally shown the patrol link to all
mobile users.

The diff HTML is updated to allow skins to have opinions on whether the
patrol link is displayed or not. By default it is hidden which is the
status quo.

Bug: T357213
Change-Id: I71eed29aed22b79367286c1761cf744a83609967
2024-02-12 21:54:16 +00:00
James D. Forrester
102a4f8a35 build: Upgrade mediawiki/mediawiki-phan-config from 0.13.0 to 0.14.0 manually
* Switch out raw Exceptions, mostly for InvalidArgumentExceptions.
  * Fake exceptions triggered to give Monolog a backtrace are for
    some reason "traditionally" RuntimeExceptions, instead, so we
    continue to use that pattern in remaining locations.
* Just entirely give up on PostgresResultWrapper's resource vs. object mess.
* Drop now-unneeded false positive hits.

Change-Id: Id183ab60994cd9c6dc80401d4ce4de0ddf2b3da0
2024-02-10 02:22:41 +00:00
James D. Forrester
4bae64d1c7 Namespace includes/context
Bug: T353458
Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
2024-02-08 11:07:01 -05:00
Bartosz Dziewoński
4aebcfe097 Change more uses of getDBLoadBalancerFactory() to getConnectionProvider()
Some less trivial cases. Also update variable names.

This doesn't really change anything, but I hope it helps promote
getConnectionProvider() as the common way to do this.

Follow-up to 8604c384f6.

Change-Id: I6657d783375fac5c7fa856b884ff1fb09285e94c
2024-01-23 16:34:45 +01:00
Amir Sarabadani
b7c5d05813 PoolCounter: Namespace classes
Two of the classes in this directory have already namespaced to
MediaWiki\PoolCounter.

Bug: T353458
Change-Id: Ie41f8d935f7623bb40040a5eb78f99c6d7b7b75e
2023-12-20 09:32:19 +00:00
James D. Forrester
9bfb75ff90 Namespace ParserOutput
Most used non-namespaced class!

Bug: T353458
Change-Id: I4c2cbb0a808b3881a4d6ca489eee5d8c8ebf26cf
2023-12-14 14:57:34 -05:00
Umherirrender
72d6b46339 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statements and changes to docs done manually

Change-Id: I443aada1c18c8628b02671aa9fd6f441961e5c2e
2023-12-11 16:07:18 +01:00
Martin Urbanec
29af4dd074 Move user options related classes into its own namespace
There are a couple of user options related classes already,
and the T321527 work on dynamic defaults is going to add
even more. Let's move them into a separate namespace
to make core a bit more organized.

Old name is kept as an alias for compatibility purposes.

Bug: T321527
Bug: T352284
Change-Id: I9822eb1553870b876d0b8a927e4e86c27d83bd52
2023-11-29 13:27:13 +01:00
Ammarpad
9dc220ecce diff: Fix LinkRenderer method call
Bug: T349726
Follow-up: Ie8ac1aab6d2fe5f4575a6891c36efe497458e093
Change-Id: Ibd728d171ce7e821f9a67131ad466d779681fe49
2023-10-25 17:18:23 +01:00
Jon Robson
483065c46c Diffs: Use JS friendly data timestamp instead of mediawiki timestamp
This is more useful for JavaScript clients.
Follow up to 7f554fc74

The diff timestamp is also moved to its own HTML element
to account for hidden revisions.

Bug: T240624
Change-Id: Ie8ac1aab6d2fe5f4575a6891c36efe497458e093
2023-10-23 21:55:28 +00:00
jenkins-bot
337029cbbb Merge "DifferenceEngine: Wrap edit, undo thank link tools with CSS parentheses" 2023-10-17 19:00:19 +00:00
jenkins-bot
53a7614975 Merge "DifferenceEngine: Add user meta information on diff pages" 2023-10-17 18:02:14 +00:00
MusikAnimal
d3903b9c2a TextSlotDiffRenderer: show tooltip instead of help icon on inline switch
Also add to the switch itself, not just the label

Bug: T346429
Change-Id: Ia7319a63878e029765c08a44f890fe96205c35da
2023-10-17 12:31:49 -04:00
Jon Robson
be79192269 DifferenceEngine: Wrap edit, undo thank link tools with CSS parentheses
This allows other skins to skin these differently.

Bug: T240624
Change-Id: I3232c2f5075ae6ef2ba5a1bdcd63530461919b6f
2023-10-17 15:49:13 +00:00
Jon Robson
32dd2fb2b5 DifferenceEngine: Add user meta information on diff pages
This will be used to consolidate the mobile and desktop diff
pages. This useful information could also be incorporated into
desktop skins at a future date.

Bug: T347779
Change-Id: If1f6f75ea829e8754fc51c7c15a2f47ad16dba52
2023-10-17 15:48:54 +00:00
thiemowmde
0a453b6c37 Remove meaningless /** #@- */ comments
Some of these comments are more than 20 years old. Almost all of them
are copy pasted from somewhere else, most certainly without knowing
what they mean. I can only guess that they have been part of some
ancient code folding feature that's not supported any more. Even if,
almost all of them are misplaced by now because the surrounding code
changed without updating the comments.

Change-Id: I53c37f050574a530ec772b7a07b67d84b31bb7a0
2023-10-15 12:30:28 +02:00
hmonroy
aae15dca22 diff: add help message to inline switch
Add help message that explains what the inline toggle does when you click
it.

Remove 'diff-table-format-label` text since it is not being used.

Bug: T346429
Change-Id: Idc3aefffd03d491a573b27c7e18b337f68bbc9cf
2023-10-13 12:09:40 -07:00
jenkins-bot
5dd2ee1e3b Merge "DifferenceEngine: Separate previous/next from diff itself" 2023-10-11 02:12:32 +00:00
Jon Robson
4bbfde052a DifferenceEngine: Separate previous/next from diff itself
Having these controls in the diff makes it very difficult to
adapt the diff page for mobile screens. It is proposed we add
links at the top of the diff page, that are initially hidden.

These will initially be used in Minerva skin and possibly
upstreamed at a later date for all skins.

Change:
* Add previous / next breadcrumbs at top of diff page

Bug: T347780
Change-Id: Iae6c140cde54d807204e6d2b8c7b6599f75df89e
2023-10-10 22:00:46 +00:00
jenkins-bot
f7049ef7ff Merge "DifferenceEngine: Comments on diff page should be themeable" 2023-10-10 18:56:41 +00:00
jenkins-bot
4af120071a Merge "DifferenceEngine: Make timestamps data readable" 2023-10-10 18:46:09 +00:00
MusikAnimal
02e7fdb26a diffs: add line number headings to inline diffs
Adds new regex in BaseTextDiffer::localizeLineNumbers() to work with
wikidiff2 inline diffs as well as table diffs.

Since there are no "columns" in inline mode, we have a new message to
indicate how the line numbers changed from the old diff versus the new.

Deprecate DifferenceEngine::localiseLineNumbers() as no longer used and
redundant to BaseTextDiffer::localizeLineNumbers().

Bug: T346460
Change-Id: I7b195879b677e2242ad73070fe19ad82121576a8
2023-10-09 22:53:14 -04:00
Jon Robson
0b2ccb89cd DifferenceEngine: Comments on diff page should be themeable
Remove hardcoded parentheses in favor of CSS pseudo elements to
support different display in different skins.

There should be no visual change in any skin with this change.

Bug: T117279
Change-Id: Iaea122647893acfa405d413e851e14949fb4b8d3
2023-10-04 18:16:58 +00:00
Jon Robson
7f554fc748 DifferenceEngine: Make timestamps data readable
The Minerva skin renders a relative timestamp.
Having this data attribute available will allow the Minerva
skin to render a relative timestamp on this page.

Bug: T117279
Change-Id: Ib66de95bdeca6e9bfa082889f0ed0740dbf8639f
2023-10-04 11:12:37 -07:00
jenkins-bot
5d693f3ff0 Merge "DifferenceEngine: Distinguish between table and inline diffs" 2023-09-29 23:18:23 +00:00
Jon Robson
e832b8f190 DifferenceEngine: Distinguish between table and inline diffs
Having a different class on the diff allows different styling
in the different contexts.

Bug: T117279
Change-Id: I32fc945dac113453351c07bd75fbf2835e616ce2
2023-09-29 22:37:45 +00:00
Maryum Styles
3cc1781815 SECURITY: DifferenceEngine: hide diff-multi-sameuser message for supressed revisions
CVE-2023-PENDING

reduce the edit count if a user for a given revision is suppress-deleted

Bug: T341529
Change-Id: I79539464cf3500065cb4f42e1542ff5feec31395
2023-09-29 00:32:14 +01:00
Daimona Eaytoy
95d75e831a Add first batch of taint-check annotations
These are the same as taint-check's MediaWikiSecurityCheckPlugin.php.

The notable exception is methods in WebRequest that were previously
hardcoded as returning a safe value. This was a consequence of said
methods return safe types (e.g., int, bool). Instead of adding
taint-check annotations, add return typehints instead, which let
taint-check remove any taintedness.

Fix some taint-check issues that were previously not spotted or whose
suppressions were removed in other patches.

Also fix the following bugs spotted by phan thanks to the type hints:
- SpecialExport did not have explicit handling of null $depth, and just
  returned 0 because null fails both the < and the > comparisons.
- Improve documentation of params and props in ProtectedPagesPager.
  SpecialProtectedPages can pass null $namespace and $size.
- Remove unused parameter from SpecialProtectedPages::showOptions, of
  which $ns and $size were not documented as nullable.
- Add FIXMEs in SpecialVersion about very inconsistent escaping.

Bug: T321806
Change-Id: I726f528856614c92329683a0ad8936a42e262748
2023-09-23 17:51:06 +02:00
James D. Forrester
1d0b7ae1e2 Namespace User under \MediaWiki\User
Bug: T166010
Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
2023-09-19 19:18:16 +00:00
jenkins-bot
85addf1312 Merge "Use OutputPage::setPageTitleMsg() instead of ::setPageTitle()" 2023-09-19 18:42:52 +00:00