Commit graph

714 commits

Author SHA1 Message Date
Daimona Eaytoy
ab6de6305b Use DeletePage in ApiDelete and DeletePageJob
Bug: T288758
Change-Id: I1cd9b18214df93bdcc0ff1e9dbd937368841e538
2021-10-05 13:25:36 +00:00
jenkins-bot
10490802e7 Merge "Change null to [] for html attributes on call of Html functions" 2021-09-29 16:20:41 +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
Umherirrender
769bdbf091 docs: Fix nullable documentation for class properties
Change-Id: I6d0577124d852103f485ffdc819876a13f6641c3
2021-09-24 00:54:53 +00:00
Umherirrender
362a48e316 Change null to [] for html attributes on call of Html functions
Change-Id: Ia84f5b1f210396cba5daa7b9e8bb8c4069e0171d
2021-09-22 22:47:28 +02: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
8d7201894c Drop action api token methods deprecated in 1.24
Removes deprecated API endpoints and modules for dealing with
CSRF tokens.

Note: i18n messages are removed in a followup for ease of revert.

Bug: T280806
Depends-On: Ic83f44587db119ff2e3e6d5ff33a10894e0695e7
Change-Id: I58aedec6942ac5d3c21574cb0072f00ef365098c
2021-09-13 15:22:16 +00:00
jenkins-bot
27a6c36d0a Merge "build: Update mediawiki/mediawiki-phan-config to 0.11.0" 2021-09-08 03:06:10 +00: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
James D. Forrester
3407458ea0 MWExceptionHandler: Rename rollbackMasterChangesAndLog to rollbackPrimaryChangesAndLog
Change-Id: I9a90b4f74eb65cd9e20ae9faa6d1949be96543c0
2021-09-03 17:36:34 -07:00
Umherirrender
de676bd359 API: Change object specs for remaining un-serviced API modules
There are no services yet to use on these API modules.
Prepare for easier injection for the future.

Modules are:
- ApiLogout
- ApiRsd
- ApiTokens
- ApiCheckToken
- ApiCSPReport
- ApiEmailUser
- ApiRevisionDelete
- ApiManageTags
- ApiFormatJson
- ApiFormatPhp
- ApiFormatXml
- ApiFormatNone
- ApiQueryCategories
- ApiQueryCategoryInfo
- ApiQueryExternalLinks
- ApiQueryBacklinksprop
- ApiQueryImages
- ApiQueryIWLinks
- ApiQueryAllCategories
- ApiQueryMyStashedFiles
- ApiQueryBacklinks
- ApiQueryCategoryMembers
- ApiQueryExtLinksUsage
- ApiQueryIWBacklinks
- ApiQueryLangBacklinks
- ApiQueryPagesWithProp
- ApiQueryPagePropNames
- ApiQueryRandom
- ApiQueryTags
- ApiQueryTokens

Also normalize use of trailing commas.

Bug: T259960
Change-Id: Ibe8a79abf6fce70713775d07d4f4b5a1338934f6
2021-09-03 23:23:03 +00:00
Tim Starling
ba5c3039ce Reduce Special:Contributions query count
ContribsPager was doing an actor table query from User::load() for
every row. Instead pass a UserIdentity to the constructor which can
cache the user ID. Most callers already had a UserIdentity with the
data already cached.

There are some weird kinds of targets which are not really users, but
UserIdentity was constructed unconditionally already, so I'm not
changing that. I did allow the target option to still be used in case
there is any future problem with round tripping strings through
UserIdentity.

Add integration tests.

Change-Id: Ifd05103fa648d0778ef5185fc73128d38d5fce74
2021-08-25 16:19:10 +10:00
Roman Stolar
3d1f0d7f7a Replace Content::preSaveTransform call to ContentTransformer::preSaveTransform
Bug: T287156
Change-Id: I5709441318abc210b3d3beb0be6f2bcbe45ddd36
2021-08-19 20:29:28 +03: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
jenkins-bot
6b161eb7f0 Merge "Api: Convert errorformat to use PARAM_HELP_MSG_PER_VALUE" 2021-07-13 13:52:30 +00:00
jenkins-bot
37cc141946 Merge "api: Inject GroupPermissionsLookup into modules" 2021-07-06 21:41:56 +00:00
Umherirrender
aa39959bc6 api: Inject GroupPermissionsLookup into modules
Remove the @internal getter for the global and
use MediaWikiServices directly at one remaining place.

Change-Id: I120f9c00d22d6dcf2a996eec5b9d5e5d41b68284
2021-07-06 20:48:35 +00:00
Umherirrender
d146800ee8 api: Inject services into ApiWatchlistTrait
Bug: T259960
Change-Id: I73596f8c924ec4a02a7042608d19a35f82bb752a
2021-07-06 20:15:30 +00:00
jenkins-bot
3278ec3411 Merge "api: Inject services into ApiUpload class" 2021-07-05 10:01:51 +00:00
DannyS712
27d9452f6d Inject dependencies into SearchApi
Used in api classes where services can be injected,
no need to rely on MediaWikiServices

Will make it possible to convert ApiOpenSearchTest to
a unit test, since everything is injected, but that will be
done in a follow-up

Plus some minor cleanup to SearchApi

Change-Id: If0a3a60f1ead897947143b57d98a3a506387f6d5
2021-07-04 10:58:36 +00:00
jenkins-bot
10d4adf6e1 Merge "api: Replace deprecated WikiPage::factory in ApiEditPage" 2021-07-02 13:15:07 +00:00
jenkins-bot
c7511db543 Merge "api: Inject PreferencesFactory into ApiOptions" 2021-07-02 13:12:01 +00:00
Umherirrender
4a74f71af6 api: Inject services into ApiUpload class
Bug: T259960
Change-Id: I2d02dd433fbf6b534a8af1f405fee761feed3654
2021-07-02 14:51:26 +02:00
Umherirrender
c9319f7b55 api: Replace deprecated WikiPage::factory in ApiEditPage
Change-Id: Ic62d9144f64c32a3d403984a0e04f590c9a67188
2021-07-02 14:35:14 +02:00
Umherirrender
c7e223e08d api: Inject PreferencesFactory into ApiOptions
Change-Id: I6242f5018075e1500d87c8375c971b383aba41f6
2021-07-02 14:21:50 +02:00
jenkins-bot
d88ba96371 Merge "api: Replace deprecated User::getAllGroups in ApiUserrights" 2021-07-01 03:45:24 +00:00
jenkins-bot
372728368c Merge "api: Replace deprecated WikiPage::factory in ApiParse" 2021-07-01 03:36:02 +00:00
jenkins-bot
e3bb282c9e Merge "api: Replace UserCache in ApiUnblock" 2021-07-01 03:27:14 +00:00
Umherirrender
fdc64ef20c api: Replace UserCache in ApiUnblock
Inject and use the new UserIdentityLookup service

Change-Id: I1e5cbae12115423a82316d7234b5cfc02d27dd3b
2021-06-30 23:08:01 +02:00
Umherirrender
576ccf392d api: Inject services into ApiEditPage
Bug: T259960
Change-Id: Idf6eee7fed14495a8ab6e05a768fcb28178a4c2f
2021-06-30 22:30:28 +02:00
Umherirrender
3b327cc98b api: Replace deprecated User::getAllGroups in ApiUserrights
Change-Id: I4f8807b4154fd2434201b945b99585e926cb2cbd
2021-06-30 21:20:56 +02:00
jenkins-bot
3f03d454f3 Merge "api: Replace User::whoIs in ApiBlock" 2021-06-30 19:15:27 +00:00
Umherirrender
82d7d70987 api: Replace deprecated WikiPage::factory in ApiParse
Change-Id: I9e9b223c29ba7a53a02ed82314df71c6a46e4126
2021-06-30 20:53:31 +02:00
Umherirrender
9a3c1add97 api: Replace User::whoIs in ApiBlock
Inject and use the new UserIdentityLookup service

Change-Id: I56b0ba599b5e86f568a5d7db6d27776ba52e1dc5
2021-06-30 20:31:54 +02:00
Alexander Vorwerk
9f985e643f ApiParse: inject services
Bug: T259960
Change-Id: I99813c65ef4a9bf469388d5836a57c12bc389e93
2021-06-30 12:53:13 +02:00
jenkins-bot
c4eaeb329b Merge "api: Inject services into ApiOpenSearch" 2021-06-30 01:11:28 +00:00
jenkins-bot
89b080bd24 Merge "api: Inject services into ApiDelete" 2021-06-30 01:10:42 +00:00
jenkins-bot
200c6e160a Merge "api: Inject services into ApiSetPageLanguage" 2021-06-29 23:00:28 +00:00
Umherirrender
1fa849bd11 api: Inject services into ApiSetPageLanguage
Bug: T259960
Change-Id: I528bfbaf84a46248ba69533780374aebb5cdd542
2021-06-29 23:13:33 +02:00
Umherirrender
68b3b44398 api: Inject services into ApiDelete
Bug: T259960
Change-Id: I8d3956edfddfbd77411c47d003ca7a0549086a2b
2021-06-29 22:48:17 +02:00
jenkins-bot
9ffdc0dc1a Merge "api: Inject services into ApiImageRotate" 2021-06-29 20:38:10 +00:00
Umherirrender
1d8fdc20fa api: Inject services into ApiOpenSearch
Bug: T259960
Change-Id: Iaf834da5aad020fbfc2850ff786b23c134717a01
2021-06-29 20:26:58 +00:00
jenkins-bot
3fb419e51c Merge "api: Replace deprecated WikiPage::factory in ApiPurge" 2021-06-29 20:19:04 +00:00
Umherirrender
1b6d44d8d5 api: Inject services into ApiImageRotate
Bug: T259960
Change-Id: I9c89ca3f504dd8a4950bf20ff72fac4fe5d5d6b1
2021-06-29 20:59:30 +02:00
jenkins-bot
d86e6e0426 Merge "api: Use UserFactory::newAnonymous in ApiParamInfo" 2021-06-29 18:40:11 +00:00
Umherirrender
ce51bca328 api: Replace deprecated WikiPage::factory in ApiPurge
Change-Id: Id7ff8105431d63b9008e40de0ac4d931ec1e88af
2021-06-29 20:37:13 +02:00
jenkins-bot
fa2d90c222 Merge "api: Inject RepoGroup into ApiMove" 2021-06-29 18:36:07 +00:00
Umherirrender
c1ea71d635 api: Use UserFactory::newAnonymous in ApiParamInfo
Avoid factory internal constructor

Change-Id: I52fb2130a02bdf69112adc4a2f0f543f92e28d1a
2021-06-29 19:52:41 +02:00
Umherirrender
0506bf240f api: Inject RepoGroup into ApiMove
Bug: T259960
Change-Id: Ib02eb2c45de9085405fdc2e661ddddcf0bad9dc0
2021-06-29 19:40:48 +02:00
Umherirrender
72137ddde1 api: Inject services into ApiMergeHistory
Bug: T259960
Change-Id: I5e4b33d2c6db0490984e1c9e2dfe77b7bfc64293
2021-06-29 19:33:05 +02:00