Commit graph

728 commits

Author SHA1 Message Date
Reedy
86934b2fa8 Replace some more usages of Wikimedia\(suppress|restore)Warnings()
Change-Id: I2eb133a9e32116cd155f59086245bc4d15ecbfcc
2022-02-24 20:27:46 +00:00
Umherirrender
3b53613dcb api: Replace deprecated ApiPageSet::getGoodTitles in ApiPurge
Use existing variables instead of getting things every time

Change-Id: I889249fd0a4f2a0f4f2a7c1f9908109e87cf0e2a
2022-02-11 23:57:48 +01:00
C. Scott Ananian
065617f93c Add OutputPage::disableClientCache() and deprecate ::enableClientCache(false)
As far as I can tell, outside of test cases, every single time we call
OutputPage::enableClientCache() we pass it `false` and actually mean to
*disable* the client cache.  Create a new less-confusingly-named method
and deprecate the old one.

Change-Id: I7c89e20528a0d91173f0edcb997dcae631935ee5
2022-02-04 15:51:50 -05:00
Umherirrender
68808e5832 Replace deprecated JobQueueGroup::singleton()
Change-Id: Icdb301d352d302f70fefba9b40df2368cb217fd2
2022-01-27 21:37:50 +01:00
Derick Alangi
8fe9e0317f Introduce Redirect(Lookup&Store) services to handle redirects
The concept of a redirect chain didn't really work for a value of
max redirect > 1. In the ideal world, we just want to have a source
which points to target (source -> target) discarding the concept of
a redirect chain completely.

Having something like: source -> target -> target1 -> target2 doesn't
really work well with the current database design.

NOTE: Support for $wgMaxRedirect will be removed soon hence
deprecation without interfaces for replacement.

Bug: T290639
Change-Id: I469de6f85e405e8ddbe7abaa5b99b77cb9cf415d
2021-12-01 19:14:22 +01:00
jenkins-bot
c9ec808467 Merge "Expose existing 'variant' API parameter" 2021-11-23 10:42:22 +00:00
Reedy
2a2bb1e9bd Remove or replace usages of "sane"
Bug: T254646
Change-Id: I096b2cf738a1395a14f1d47bcbed0c2c686c2581
2021-11-22 13:35:17 +00:00
Sam Wilson
3cb5117116 Expose existing 'variant' API parameter
The 'variant' parameter exists and functions, but was not yet
documented.

Bug: T117549
Change-Id: Ib7347f7c6fbffd4c0cbb378a14a0166da6b3d39c
2021-11-22 11:34:41 +08:00
jenkins-bot
266bd90188 Merge "Use UndeletePage from ApiUndelete" 2021-10-28 05:05:09 +00:00
jenkins-bot
24373dab6b Merge "Replace Content::getParserOutput call to ContentRenderer::getParserOutput" 2021-10-20 17:56:19 +00:00
Roman Stolar
fa5237eb48 Replace Content::getParserOutput call to ContentRenderer::getParserOutput
Bug: T287158
Change-Id: I8a13f45027e08e2d8ddefa140dd47a0c55094934
2021-10-20 12:11:24 +03:00
jenkins-bot
3c697fd5ee Merge "api: Inject services into ApiQuery class" 2021-10-19 20:16:07 +00:00
Daimona Eaytoy
027efc625e Use UndeletePage from ApiUndelete
UndeletePage is responsible for checking permissions. As a user-facing
change, if the user cannot undelete pages, the module will error with
the "permissiondenied" code and the "badaccess-groups" message. This is
consistent with other API modules (e.g. ApiDelete), and replaces the
previous behaviour of failing with code "permdenied-undelete" and no
message explaining the failure (which seems to be a bug). For everything
else, backwards compatibility is preserved; in particular, we still die
with "apierror-cantundelete" if nothing was deleted (which UndeletePage
considers a successful operation).

Bug: T290021
Change-Id: I89f5e9e4a1e120e6ca6dd52987059baefbcb84d5
2021-10-05 13:29:27 +00:00
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
Umherirrender
5e7cd5fdd1 api: Inject services into ApiQuery class
Bug: T259960
Change-Id: I64b0c62f0c51e10c799794d8ad399dd8428f63b5
2021-09-17 00:57:37 +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