Commit graph

109 commits

Author SHA1 Message Date
jenkins-bot
33aae1deec Merge "Hard deprecate various public or protected properties of OutputPage" 2024-08-08 11:08:57 +00:00
C. Scott Ananian
2a5a1ba6c2 Hard deprecate various public or protected properties of OutputPage
These were soft deprecated in 1.38, it's time to emit deprecation warnings
so we can complete their removal from the public API.

Change-Id: I437ab7dc8af4eb5d336e8074a42a0a54b4c00a4b
2024-08-01 15:00:54 +01:00
Bartosz Dziewoński
d20454f468 OutputPage: Add showPermissionStatus(), deprecate showPermissionsErrorPage()
Now that PermissionManager can produce a PermissionStatus (1fbe8b761),
we need a way to display it without going through legacy error arrays.

Test plan:

* While logged out, access a page that all logged in users can access,
  that uses the PermissionsError class (e.g. Special:Upload)
* While not an administrator, access a page that only administrators
  can access, that uses the PermissionsError class (e.g. Special:Block)

Verify that you see the same error messages before and after this
change.

Change-Id: If21200ea1dd66f6443b03625d6a5b8ea416b2922
2024-07-29 23:33:50 +00:00
jenkins-bot
2134c3ef12 Merge "OutputPage: Inline getCdnCacheEpoch() into checkLastModified()" 2024-07-29 14:03:12 +00:00
Bartosz Dziewoński
c9f73efd5a Namespace MessageSpecifier under Wikimedia\Message\
In change I625a48a6ecd3fad5c2ed76b23343a0fef91e1b83 I am planning to
make Wikimedia\Message\MessageValue use it, and we try to pretend that
it is a library separate from MediaWiki, so it makes sense to move
MessageSpecifier to the same namespace under Wikimedia\.

Bug: T353458
Change-Id: I9ff4ff7beb098b60c92f564591937c7d789c6684
2024-07-28 14:21:32 +02:00
Timo Tijhof
0ea6d7ff32 OutputPage: Inline getCdnCacheEpoch() into checkLastModified()
This useless function contains useful documentation, that is best
kept with the rest of the business logic. It is only used once and
is literally `a - b`.

Change-Id: I650c37c4655bcc6edcd12186b24b0b1bd3faafd2
2024-07-26 15:49:25 -04:00
Ebrahim Byagowi
fab78547ad Add namespace to the root classes of ObjectCache
And deprecated aliases for the the no namespaced classes.

ReplicatedBagOStuff that already is deprecated isn't moved.

Bug: T353458
Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
2024-07-10 00:14:54 +03:30
Umherirrender
1951aea6b8 Fix various version mention for class_alias
Versions are changed in 8e940c4f21,
but that makes the version wrong

Follow-Up: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
Change-Id: Iae43725b8e0fffc4d44bf57f6227334b41290bd9
2024-07-05 18:39:49 +02:00
jenkins-bot
3f18ad1e38 Merge "OutputPage: Minor refactor to avoid calling deprecated function" 2024-07-05 01:31:38 +00:00
Bartosz Dziewoński
6d23dea9f0 OutputPage: Minor refactor to avoid calling deprecated function
This allows the deprecated formatPermissionsErrorMessage function to
start emitting deprecation warnings and be removed one day.

Change-Id: Iea190deacdadb3e6b242042cfacbb406b8d92f9a
2024-07-05 01:06:48 +00:00
Jon Robson
c33b31728d Skins: Support useskin=json
This allows rendering of the data passed to the skin rendering
layer, to allow developers to debug the information used to render
a skin.

Bug: T364696
Change-Id: I32aaa6a85d24df4f4689269f6a455823bb08196b
2024-07-02 21:29:00 +00:00
Timo Tijhof
217d47d46e Replace direct use of $wgRestPath with wfScript()
Follows-up Idb5b0d21adc6. Avoid hardcoded references to REST internal
configuration variables, which create awkward "APIs" in the long run.
These are hard to deprecate or detect use of, and even harder to
normalize/support once variations exist. E.g. in T189966 and T233886,
I've been working to remove the concept of dynamic config in favour of
the uncomputed values being only valid as configuration for the
component that owns the variable, instead of using Config as public
API to read non-normalized information that belongs to a different
component.

By making the recipient responsible for any dynamic computation, it
also becomes clear that these are in fact not normalized or validated,
which can expose any number of unpredictable behaviours if used
directly. Consider special values like `false` or `null` and the
responsibility for interpreting that. Accessing these from a stable
function also gives a natural place for deprecation to happen. The
alternative, is for dynamic computation to happen in Setup.php for
all variabls, and only ever grow and become an append-only dumping
ground for every thing that we feel at some point needs validation,
normalization or expansion, which doesn't scale well, hence I reversed
this trend in T189966/T233886.

As it happens, RestPath actually is already computed, albeit very
trivially. This patch opens the way for someone to remove that in
favour of PathRouter accept `false` directly and expanding (and testing)
that code there instead.

As for REST API, the only stable and universally supported entrypoint
is /w/rest.php. Unlike some older entry points, we don't support
moving or removing the rest.php file. We do support routing/aliasing
additional paths to it.

Change-Id: I589a8aed8db3b8e7b72e4505749bb7ef25a755d9
2024-07-01 22:01:32 +00:00
jenkins-bot
7804c43be4 Merge "OutputPage: Convert helplink icon to use codex css mixin" 2024-06-27 22:16:38 +00:00
Steph Toyofuku
d3f41c86b2 OutputPage: Convert helplink icon to use codex css mixin
Migrate this icon to codex for the purposes of having it appear in night
mode correctly.  Additionally, clean up the svg as it is no longer used

A couple notes:
1. This is not entirely visually identical to the current method - in
practice it ends up being nearly imperceptible, but worth noting that
even with the padding there is a slight vertical shift if you compare
them side by side
2. Due to the approach taken, I'm making the intentional choice to not
make this backwards compatible with cached HTML.  This means a cached
page will not have an icon for the duration it is cached, which feels
like an acceptable intermediary state, but feel free to disagree with me
in code review!

Slight visual change due to aforementioned color and position difference

Bug: T366358
Change-Id: I1c53e1c501242f9f9ab88ef8e0e4e85fb1971fbe
2024-06-27 13:12:28 -07:00
Novem Linguae
c48722c9af OutputPage: delete method getCSPNonce()
Hard deprecated since MW 1.41.

Unique method name that does not appear in CodeSearch for MediaWiki
& services at WMF. Couple of CodeSearch hits using the "Everything"
filter.

Bug: T362636
Change-Id: I2ea134d31a8b18375183a4ae413e77dc0a6f1acc
2024-06-27 15:42:24 +00:00
Umherirrender
c08b492d75 Use namespaced classes (3)
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: Ia35b2d3105880631dd26ec974068b000ac7f4b6b
2024-06-16 20:26:43 +02:00
Fomafix
bda7811bf7 OutputPage: Use single quotes instead of double quotes
where no variable expansion or escape sequences are used.

Change-Id: I5cb9debec70ebb8102f250963efad2be176153c8
2024-06-07 08:06:32 +00:00
theprotonade
54b5c3ff96 Add classname for permission error messages
Add unique classnames of the form "mw-permissionerror-$error"
on permission error message elements for easier debugging

Bug: T279915
Change-Id: I7c1a422f77b32240ebd6c40824f5b0b51329d541
2024-06-07 01:04:01 +02:00
jenkins-bot
402f7fc36a Merge "Add Phan taint annotations to OutputPage::formatPermissionsErrorMessage" 2024-06-06 21:28:24 +00:00
Bartosz Dziewoński
0d6bf5084c Add Phan taint annotations to OutputPage::formatPermissionsErrorMessage
Change-Id: I6fd56a24959a762bf0b222e267deba92322d009e
2024-06-06 18:20:01 +02:00
C. Scott Ananian
27d5ac2679 Hard deprecate OutputPage::setPageTitle() with Message argument
Bug: T343994
Depends-On: I2c0a5ff8055eea5e23f402c25174b8ebcd7d25af
Depends-On: I75508e494dd47bfe38be65d9cca8595edd662937
Depends-On: I91eaadd56aca7896c1329d13bc78c260fc4f6d8d
Depends-On: If92935766461edc1375d277066c2768415a45744
Change-Id: Ie125f229cd356c5a056c983389f92b4d5f8da98f
2024-05-31 19:23:26 +00:00
jenkins-bot
31a72c9b71 Merge "REST: introduce OpenSearchDescriptionHandler" 2024-05-21 19:54:56 +00:00
jenkins-bot
5a74e8a7b6 Merge "Add namespace and deprecation alias to TextContent" 2024-05-20 00:47:30 +00:00
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
Ebrahim Byagowi
d21cc67450 Add namespace and deprecation alias to FileBackend
This patch introduces a namespace declaration for the
Wikimedia\FileBackend to FileBackend and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Id897687b1d679fd7d179e3a32e617aae10ebff33
2024-05-19 22:35:58 +03:30
daniel
879846b29c REST: introduce OpenSearchDescriptionHandler
Move open search description endpoint from /w/opensource_desc.php
to /w/rest.php/v1/search.

Bug: T363984
Change-Id: Idb5b0d21adc6152ef77e6d17846b6acc6a904e01
2024-05-18 17:29:07 +00:00
jenkins-bot
c5387f3802 Merge "[OutputPage] Hoist "null Title" checks up a level" 2024-05-18 15:19:50 +00:00
Ebrahim Byagowi
ccde5085de Add namespace and deprecation alias to JavaScriptContent
This patch introduces a namespace declaration for the
MediaWiki\Content to JavaScriptContent and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I87c17327911e28a461feaf2ff46242454cff257a
2024-05-17 13:51:18 +03:30
C. Scott Ananian
f61760614d [OutputPage] Hoist "null Title" checks up a level
Add strict types to private parsing-related methods
OutputPage::parseInternal() and OutputPage::addWikiTextTitleInternal()
and in the process hoist the "null Titles are not allowed" assertion
up a level to the callers.

Adjust some phan suppressions after this change.

Change-Id: If828d9ffa1edc292a1aca3eb6fe36daffa100bd4
2024-05-15 11:25:36 -04:00
jenkins-bot
20d4c113da Merge "OutputPage: Use the same script tag pattern as Html::inlineScript()" 2024-05-13 12:41:08 +00:00
Func
f6ee77a3e5 OutputPage: Use the same script tag pattern as Html::inlineScript()
Not sure why they are different in the first place, probably a mistake.

The `user` and `site` modules would be embeded as a string, so can be
previewed with <script> etc escaped properly, leaving the bug only
reproducible with User/global.js via the GlobalCssJs extension.

Bug: T360258
Change-Id: I61a3d9926dbfd7630c37bebd9d46fa49b05a4fc6
2024-05-13 12:16:43 +00:00
Bartosz Dziewoński
d116ea0bce Tweak docs stating that time values can be booleans
I just don't see how that could be correct.

Change-Id: I193d2df26db401b33bcc9e6a82f3842ff5b8b56e
2024-05-11 23:51:25 +00:00
Amir Sarabadani
214674d6b1 namespace MWDebug
Bug: T353458
Change-Id: I99d728bd111ff882220cd175ff09d4da20b81eae
2024-05-03 22:59:47 +02:00
jenkins-bot
22b42ae351 Merge "OutputPage: Omit browser default <link> for $wgFavicon or $wgAppleTouchIcon" 2024-04-29 16:17:13 +00:00
alistair3149
a8d8b1b06b OutputPage: Omit browser default <link> for $wgFavicon or $wgAppleTouchIcon
These link elements are unnecessary because (in this case) the locations are the default location for the files concerned.
They will be checked anyway by user-agents that make use of such files, so pointing to them is a waste of space.

Bug: T21392
Change-Id: I5e063bd002111243f6b38da1989a7baf2e4e05d3
2024-04-29 15:47:30 +00:00
jenkins-bot
af9b10ae24 Merge "Make HTTPFileStreamer testable" 2024-04-27 02:01:23 +00:00
daniel
9672a6e5e4 Make HTTPFileStreamer testable
This also improves ThumbnailEntryPointTest by allowing it
to assert which headers got sent.

Change-Id: I33911775bce1b3cc7a53a03c2be50d53a28fabd1
2024-04-26 13:22:55 +02:00
Bartosz Dziewoński
6c47bfbd88 OutputPage: Deprecate showFatalError()
It's just a worse version of showErrorPage().

Only 1 use in MediaWiki core, no uses in WMF-deployed extensions,
very few uses elsewhere.

Change-Id: I091e789891f60ed97dd84a25c2b2e0456a1af01e
2024-04-26 00:10:06 +02:00
Bartosz Dziewoński
02044a5ba1 Document more methods that accept MessageSpecifier, not just Message
These methods can already handle any MessageSpecifier, but their
documentation didn't show this.

Change-Id: I1323d18baf17a8a27cc9bed31860c4cc89e61a22
2024-04-09 20:25:18 +02:00
Bartosz Dziewoński
603ef2f29c OutputPage: Mostly doc improvements for passing message params
* showPendingTakeover(): While $params can technically be
  a MessageSpecifier (because a message can take another message
  as a parameter), we don't usually explicitly document that,
  and it seems like a result of some misunderstanding here.
  Allow variadic parameters instead, like most message functions.

* addWikiMsg(): Document the hidden message key parameter, making
  it really required. Remove documentation that refers to functions
  removed many versions ago. Document a weird limitation on the
  format of parameters, which is unlike most message functions.

* addWikiMsgArray(): Document a similar, but almost exactly
  opposite, weird limitation on the format of parameters.

Change-Id: Icb8822def9ce56f42ff52a8e469bb08d61d576c6
2024-04-05 23:46:13 +02:00
jenkins-bot
638236e3fe Merge "Introduce entry point classes for media files." 2024-04-03 15:50:32 +00:00
daniel
9638fa314a Introduce entry point classes for media files.
This moves a code out of file scope into classes to make it
testable. The code is left in the same structure as it was before,
global functions have been converted into methods on the new
ThumbnailEntryPoint and Thumbnail404EntryPoint classes.

This test introduces comprehensive phpunit tests covering all functional
code paths in ThumbnailEntryPoint. This is intended to support
refactoring of this code.

Change-Id: I459abc7b11d0ab4ee682a863c9525a945048296f
2024-03-30 21:14:05 +01:00
James D. Forrester
8e940c4f21 Standardise all our class alias deprecation comments for ease of grepping
Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
2024-03-19 20:11:29 +00:00
Timo Tijhof
3903c8cfec ResourceLoader: Migrate wfGetDB call to ICP and move to WikiModule
* Remove references to IDatabase from preloadModuleInfo() and with
  it the last reference to Rdbms in the ResourceLoader service
  (progressing T32956).

* Simplify WikiModule::preloadTitleInfo() so that it doesn't need
  an IDatabase object unless
  1) there are non-zero WikiModule objects in the batch, and
  2) there is a cache miss.

* Remove needless IDatabase parameters passed or mocked for this
  method. Note that WikiModule already had `@group Database` set
  since each WikiModule::getDB() is called and uses an unmocked
  database. The mocked database was only injected to satisfy the
  method signature.

Bug: T32956
Bug: T359522
Change-Id: I022f02d6e6bbae46c3258a7c07a1d6723506d8bc
2024-03-11 19:39:24 +01:00
Bartosz Dziewoński
877db7e618 Fix use of array keys in SessionManager::getVaryHeaders()
The method returns the headers as array keys, not as values (the
values were formerly used for something else, and are now unused).

Add type hints that would have caused Phan to warn about this mistake.

Follow-up to 8c97b87319.

Change-Id: Ic99beafae8896821677ec0a49ba9366044990159
2024-03-08 14:24:35 +01:00
Gergő Tisza
038ec7be40 Revert "Output: Add IframeSandbox class"
This reverts commit cb09a27cc2.

The class is not very useful as it is now, due to performance issues
(T169027#9342985). The Graph extension is not going to use iframes
(T334940#9537862) and that was the only concrete feature for this, so
making the class usable in practice is unlikely to get prioritized.
No point in leaving the code in its current halfway state.

Bug: T222807
Bug: T169027
Change-Id: Id1b5193975435b58aebc225528e30f04456d0c41
2024-03-04 12:32:23 -05:00
James D. Forrester
35b2542895 Namespace includes/cache
Bug: T353458
Change-Id: Ic3f3168ef17113f5fb3ec11e0a47f52d65eefba9
2024-02-20 10:28:03 -05:00
Subramanya Sastry
e55cc517da Move Parser to Mediawiki\Parser namespace
Bug: T166010
Co-Authored-By: Daimona Eaytoy <daimona.wiki@gmail.com>
Co-Authored-By: James Forrester <jforrester@wikimedia.org>
Co-Authored-By: Subramanya Sastry <ssastry@wikimedia.org>
Change-Id: I79b4e732c45095eedbaa80afa5eb7479b387ed8a
2024-02-16 09:18:38 -05:00
James D. Forrester
eeb5a740b3 Namespace Message, move to appropriate directory
Bug: T353458
Change-Id: I088cbc53fbcdb974e5b05b45a62e91709dacc024
2024-02-14 15:10:36 -05:00
Piotr Miazga
5c662a4d9e skins: Remove deprecated Skin::bottomScripts
Remove the Skin::bottomScripts method which was deprecated in 1.37.
Code search shows no usages across WMF repositories.

Change-Id: Ifdd890ad9ddae2a8bbdb32ddf9444306b0e93c09
2024-02-13 19:07:32 +01:00