Commit graph

856 commits

Author SHA1 Message Date
jenkins-bot
5535b42559 Merge "Add SpecialExportGetExtraPagesHook" 2021-10-11 22:00:33 +00:00
DannyS712
b9663bed45 Convert TrackingCategories to a service with DI
Bug: T247194
Change-Id: I50012e2a5e65aeee7671023d2fd5367e21e8ae67
2021-10-08 16:36:20 -04:00
Cindy Cicalese
37a9e60ca5 Add SpecialExportGetExtraPagesHook
This hook allows extensions to add additional pages to the list of
pages being exported. For example, if an extension creates supplemental
pages that must be exported along with a content page, this hook will
allow the extension to export the supplemental pages automatically when
the content page is exported.

Bug: T292378
Change-Id: I3b6b466b6ed32b1939674872df9e431bd6941645
2021-10-04 10:33:04 -04:00
jenkins-bot
e2861ca8bb Merge "Replace deprecated User function in ChangesListSpecialPage" 2021-10-01 15:17:39 +00:00
Umherirrender
6541f20e2d Replace deprecated User function in ChangesListSpecialPage
Call the UserFactory only for registed users
Changed static property to abstract function similar to
0d48f7d25b

Bug: T277600
Change-Id: I07934d0c1c172c4f7e15d9922c7929a6e8dbc0df
2021-10-01 12:01:33 +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
Reedy
bc224d0498 QueryPage: s/Sometime/Sometimes/
Change-Id: Ibdc16044fabfe9fe3677985d10b2dbe1ac2e7c84
2021-09-27 23:43:14 +01:00
jenkins-bot
86fa9b40a5 Merge "Inject UserIdentityLookup into SpecialLog" 2021-09-26 19:22:47 +00:00
Alexander Vorwerk
0f2008bcd8 Inject UserFactory into special pages
Change-Id: I2ca5c6bdec1bbf0c64270e55d29151f75935d480
2021-09-25 19:06:57 +02:00
Alexander Vorwerk
fd094c5bb7 Inject UserIdentityLookup into SpecialLog
Change-Id: Ifc17a7ef38da60ec1534b39df1657f2394cbcb59
2021-09-25 18:36:37 +02:00
Umherirrender
769bdbf091 docs: Fix nullable documentation for class properties
Change-Id: I6d0577124d852103f485ffdc819876a13f6641c3
2021-09-24 00:54:53 +00:00
jenkins-bot
76ba780e41 Merge "WikiExporter: inject services" 2021-09-16 17:04:04 +00:00
DannyS712
a2b20b63d7 Emit deprecation warnings reading from $wgUser
With this patch deprecation warnings will be emitted
if $wgUser is accessed or written into. The only pattern
of usage still allowed is

$oldUser = $wgUser;
$wgUser = $newUser;
// Do something
$wgUser = $oldUser;

Once there is no deprecation warnings, we know that nothing
legitimately depends on $wgUser being set, so we can safely
remove the code that's still allowed as well.

Bug: T267861
Change-Id: Ia1c42b3a32acd0e2bb9b0e93f1dc3c82640dcb22
2021-09-15 20:17:04 -07:00
Petr Pchelko
5afc62f258 Remove stub threshold feature
Bug: T284917
Change-Id: I5c9ea04a9deca136bb7210f07200d18f97fd6686
2021-09-13 09:26:38 -07:00
jenkins-bot
6e99ddcef6 Merge "Mark hidden tags on Special:Tags and show in RCFilters" 2021-09-10 08:54:20 +00:00
Bartosz Dziewoński
0d3fa1d14c Mark hidden tags on Special:Tags and show in RCFilters
Bug: T281741
Change-Id: I8122fdc709427adc4681b463a52530117fabaef3
2021-09-09 19:38:46 +02: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
Alexander Vorwerk
2fbf13812a WikiExporter: inject services
This patch injects services into WikiExporter. It also adds a
WikiExporterFactory service for creating WikiExporter instances.

Change-Id: Ib1547defea54c309865c116bc83d617c21568843
2021-09-06 10:03:37 +00:00
jenkins-bot
d28c8785e9 Merge "Rename PHP class RandomPage to SpecialRandomPage" 2021-09-04 02:01:18 +00:00
Umherirrender
2e4ee47c3d Cleanup mixed space/tab line indent
Change-Id: I833052a656b1ce419c0929f6f0514f2a33c2c4cc
2021-09-04 00:52:31 +02:00
jenkins-bot
c6d4568a7b Merge "docs: Improve doc types around changes list and the changes special page" 2021-09-03 20:58:48 +00:00
Fomafix
12f9cba673 Rename PHP class RandomPage to SpecialRandomPage
This change is for consistency to the file name and to other classes.

The old class name RandomPage is kept as alias for compatibility and is
now deprecated.

Also change the letter case in the class names and file names:
* SpecialRandompage     -> SpecialRandomPage
* SpecialRandomredirect -> SpecialRandomRedirect
* SpecialRandomrootpage -> SpecialRandomRootPage

The change of the letter case of file names may cause problems on
Windows operating systems.

Change-Id: If4dd23126e0d032f42a86aff7d09414edcb1ade2
2021-09-03 09:26:06 -07:00
Umherirrender
4d42b5e86e docs: Change wording master to primary in comments and log text
Bug: T254646
Change-Id: I5379dc79be60c99f0a30f74e5d624f81fe6f921b
2021-09-01 23:04:40 +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
jenkins-bot
91937218cb Merge "Make use of Html class utility methods in a few places" 2021-08-31 15:39:39 +00:00
Umherirrender
64fc8455a4 special: Fix doc of SpecialPageFactory::get(Usable|Regular)Pages
Change-Id: Id34e1a711e967649a02214aef7a118ef3853c2e2
2021-08-30 23:07:50 +02:00
Timo Tijhof
e387cd9c35 Change trivial use of getVal('action') to getRawVal
Per docs added in I18767cd809f67b, these don't need normalization
as they are only compared against predefined strings, and besides
are generally entered manually in a form, and even then would not
require the kinds of Unicode chars that have multiple/non-normalized
forms.

In nearby areas to also fix some trivial cases:

* getVal('title') obviously needs normalization.
  Use getText() to make this more obvious.

* getVal() compared against simple string literals within the code
  obviously don't need normalization (e.g. printable === 'no').

* Change hot code in MediaWiki checking for whether 'diff' or 'oldid'
  are set to getCheck (which uses getRawVal) instead of getVal.
  As a bonus this means it now handles values like "0" correctly,
  which could theoretically have caused bad behaviour before.

Change-Id: Ied721cfdf59c7ba11d1afa6f4cc59ede1381238e
2021-08-26 22:11:58 +01:00
jenkins-bot
40c423d441 Merge "Simplify if-then-else-return statements with explicit true/false" 2021-08-24 11:44:23 +00:00
tsepothoabala
9cafcd885f Fix namespace blocks of removed extension namespaces
Bug: T280798
Change-Id: If6dc2a7d777121c072088cced1078803e10b79c9
2021-08-23 12:42:17 +02:00
Umherirrender
220fd020c4 Simplify if-then-else-return statements with explicit true/false
When both branches returns a bool, use the condition as return value

Change-Id: I59416aa021d0ada77d84fda4aaf7def0eea54009
2021-08-17 23:19:04 +02:00
DannyS712
3d7ef1762c Make use of Html class utility methods in a few places
Each files' changes can be reviewed independently

There may be places in the files that I didn't catch -
this is not meant to be an exhaustive replacement

Even where it may make sense to use Html::element,
Html::rawElement is used in this patch to avoid changing
any behavior.

Change-Id: I26eaacc65106f10a5066c31d82f6594a59ff1281
2021-08-12 08:49:37 +00:00
Alexander Vorwerk
0d48f7d25b Hard deprecate User::getIntOption()
deprecated since 1.35 and unused

Bug: T274211
Change-Id: If739492953ee53a39c81894c48f16be81c845542
2021-08-11 14:16:40 +02:00
Petr Pchelko
24ae5a6318 Use CentralIdLookup service instead of static factory
Change-Id: Ia0f263b4eff00cc6efee7a88c62d562dafd57950
2021-07-26 07:00:53 -07:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
Petr Pchelko
5c2409ae1a SpecialBlock: replace User with UserIdentity
Change-Id: Ib4ad056cef96e2bce41a8b36b6d3d24036824052
2021-06-30 13:55:11 -07:00
TChin
00f48f2151 Turn hashes into comments
Standardized double-slash comments

Bug: T285484
Change-Id: I5dd8a0ecd78063751ae6d009359cdc449e1b2fb8
2021-06-24 14:45:10 -04:00
Petr Pchelko
9d1b346c77 NewPagesPager: remove unused UserFactory
Change-Id: I6db722914669c92613ff7b0d9f87fd8adf1a52c7
2021-05-28 00:59:06 +00:00
jenkins-bot
06457facaa Merge "Clean up NewFilesPager: remove deprecated and unused services" 2021-05-27 17:23:27 +00:00
jenkins-bot
236018d5e3 Merge "Replace RecentChange::getPerformer with RecentChange::getPerformerIdentity" 2021-05-27 14:02:54 +00:00
Petr Pchelko
4e75536609 Clean up NewFilesPager: remove deprecated and unused services
Change-Id: I682b15769f31da7e7a1a6c08b45c1a2305556f2f
2021-05-27 13:47:22 +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
jenkins-bot
a2ef517228 Merge "SpecialCreateAccount: don't reinvent the wheel for restrictions" 2021-05-27 02:05:25 +00:00
DannyS712
efed250126 SpecialCreateAccount: don't reinvent the wheel for restrictions
Add restriction support to LoginSignupSpecialPage::__construct,
and set mRestriction to 'createaccount', removes the need to
inject a PermissionManager

Change-Id: Ifd7d6e687a3c78d300cc612526458afb6934a4c0
2021-05-26 22:19:21 +00:00
Petr Pchelko
e86cfe1592 Remove deprecated SpecialPage::getRestrictedPages
Change-Id: Id3181a46e17043f6f21200e34727a7ff627e7f16
2021-05-26 13:44:58 -07:00
jenkins-bot
be5631743e Merge "WikiImporter: inject services" 2021-05-26 16:45:59 +00:00
DannyS712
f057d2253c Replace deprecated uses of PermissionManager with GroupPermissionsLookup
In a few places where a PermissionManager is used
but only GroupPermissionsLookup is needed

Also update references to the class in PermissionManager
that referred to it as GroupPermissionLookup

Change-Id: I5d7a13900852a38768a106aeee1ce012c3a04ea2
2021-05-26 05:47:21 +00:00
ZabeMath
3c978f6fc6 WikiImporter: inject services
This patch injects services into WikiImporter. It also adds
a WikiImporterFactory service for creating WikiImporter
instances.

Change-Id: I2966297e5728fca1ae8280361f1008cef6c6041b
2021-05-24 23:10:07 +02:00
Thiemo Kreuz
ac47a1a9af Don't use NamespaceInfo when it's not necessary
Change-Id: Ia568a7d3493ea3f23e58a991dbdbef10ad34fcdb
2021-05-17 07:06:58 +00:00
Tim Starling
8327d2f0ca Fix changes list "hide myself" feature
Broken by fd01c53778

Bug: T282183
Change-Id: I0ae68702f9ea160a1e649ca6c52f88cdf9a8e8e5
2021-05-12 09:45:59 +10:00
jenkins-bot
028fa9659b Merge "Remove uses and hard deprecate wfCanIPUseHTTPS" 2021-05-03 03:18:24 +00:00