Methods were deprecated in 1.39 and the majority of skins are now
updated. This change means that skins can no longer override the rendering
of the HEAD element meaning extensions can rely on ResourceLoader support,
and hooks that modify the HEAD element indirectly
The new Skin::outputPageFinal method is adding to honor the existing
outputPage method that is stable to override but to prevent extending skin classes
from generating HTML which does not include HTML generated by hooks e.g.
ResourceLoader internals. This new method is for
internal usage by OutputPage only for this reason.
This keeps all HTML generation inside
the Skin class (e.g. preserves the status quo) until we can work out better
boundaries between Skin and OutputPage.
Bug: T306942
Change-Id: Ib023ef3335bb72306a01230b6cd1169dc7652588
(cherry picked from commit c7656257159a3d85422f4558f5add6df1564f3c3)
Use OutputPage::setIndexPolicy() so that we document the change in
behavior for OutputPage::setRobotPolicy() and emit deprecation
warnings as needed.
Bug: T377586
Change-Id: Ieab6a66b7ba868acf4da2d785a44a0307c0dacc1
As a first step in a plan to reduce redundancy in OutputPage, replace
the $mIndexPolicy property of OutputPage with the corresponding
getter/setter methods in a ParserOutput held for the purpose of
storing metadata.
Bug: T301020
Change-Id: I6073f4033be936b669532ecf8104a8e5ff498e24
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
A constant is not a variable. The type is hard-coded via the value
and can never change. While the extra @var probably doesn't hurt much,
it's redundant and error-prone and can't provide any additional
information.
Change-Id: Iee1f36a1905d9b9c6b26d0684b7848571f0c1733
According to https://www.php.net/strtotime, strtotime() can emit
E_WARNING, but not E_STRICT. Anyway, which type of error it emits
doesn't really matter. The cure is the same either way, to use AtEase
or "@" silencing operator, and to explain why.
Remove outdated error code from the explaination, and while at it
replace AtEase with the silence operator (per T253461 and T272554).
Bug: T375707
Change-Id: I641d27b7e73f5ef202f096ceccf16d9f2b89a684
Move deduplication of language links out of Parser.php and into the
ParserOutput in order to be compatible with alternate Parsers (Parsoid).
Clean up various inconsistencies: ensure deduplication also happens in
OutputPage when multiple ParserOutputs are merged into the final output,
and ensure that the deduplication in LinksUpdate is done in the same
order (first link prevails) as in Parser/ParserOutput/OutputPage.
Deprecate OutputPage::setLanguageLinks() (the matching
ParserOutput::setLanguageLinks() was deprecated in 1.42).
As a breaking change, return an array, not an array *reference*, from
ParserOutput::getLanguageLinks(). This allows us to safely modify the
internal representation of language links. As far as I can tell, no one
used the returned reference to sneakily modify the list of language
links, and there not a good way to have deprecated this before making
the breaking change.
While we're at it, we've added tests to ensure that language link
fragments are preserved.
Bug: T26502
Bug: T358950
Bug: T375005
Change-Id: I82a05a51d94782ebb9fa87ff889ca0f633b3e15c
This is the fourth patch of a series of patches to remove
ParserOutput::getText() calls from core. This series of patches should
be functionally equivalent to I2b4bcddb234f10fd8592570cb0496adf3271328e.
Here we replace calls to getText where a ContentRenderer is available
close by by temporary ParserOutput::runOutputPipeline that will
eventually be replaced by a call to (probably) ContentRenderer
(T371004). Doing this work in stages allows us to separate the work of
"bring ParserOptions to the call site" from the work of "bringing
ContentRenderer(ish) to the call site", since both need to be done for
to make ParserOutput a value object (T293512).
Change-Id: Ib4f9357293dc230df6e0ca2379a1e2a4cc1b91b7
Bug: T293512
This is the third patch of a series of patches to remove
ParserOutput::getText() calls from core. This series of patches should
be functionally equivalent to I2b4bcddb234f10fd8592570cb0496adf3271328e.
Here we temporarily introduce runOutputPipeline in ParserOutput. It
creates and runs the pipeline with default options, and is called by
getText. (This is not entirely truthful because we go through a
runPipelineInternal transient method for null-argument-passing reasons,
but let's not over-complicate this commit message.)
getText is responsible for maintaining the current behaviour,
that is "disallow the cloning of the ParserOutput and putting text back
to as it was" to mitigate T353257. As we get rid of getText, this
behaviour should be moved, if necessary, to the caller site.
The new method is currently added to ParserOutput so that further
refactorings are, for the moment, simpler. It will eventually be moved
to another place within the Content framework.
We also rename 'suppressClone' to 'allowClone' (which is actually its
negation) to avoid multiple levels of negations that make the code
confusing. Note that the default value of 'allowClone' is true, and is
currently overriden in two places: getText and
OutputPage::getParserOutputText (which calls the pipeline directly and
not through ParserOutput).
Bug: T293512
Bug: T371022
Change-Id: Ibf04af1079aaa1934dc78685b00e636ff4d38a9a
The hook OutputPageMakeCategoryLinks was only used by extension
CategoryTree:
https://codesearch.wmcloud.org/search/?q=OutputPageMakeCategoryLinks
CategoryTree switched to the new hook OutputPageRenderCategoryLink.
Depends-On: Ic86f210474cbc0e2dcebf664cf2309a4a4408f60
Change-Id: I8ea56f2d111aeccee158c40b8379383e92154d8a
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
This allows to change the category link rendering by extension
CategoryTree without missing update of mCategoryData and mCategories
which leads to wgCategories = [] (T372155).
The new hook will be used in extension CategoryTree by
Ic86f210474cbc0e2dcebf664cf2309a4a4408f60.
Bug: T372155
Change-Id: Id82a77a57d1f12233d974ea4c1b093f50c5ab74f
Some wikis treat the category list from ParserOutput as a /set/, others
as an /ordered list/. For those who don't care about the order of
categories, provide the option for wikis to sort the categories
in OutputPage.
This can also be activated with a query parameter, `&sortcat=1`, which
is useful to the Parsoid team when doing visual diff testing to avoid
false positives caused by differences in category ordering.
Bug: T373480
Change-Id: Idd14650a1898c6a49c88441ef024ce3012903bbe
This method has a weird behavior where it resets the category *link* list
while not resetting the category *list*. It turns out that no one actually
needs that weird behavior; in fact no one needs this method at all, since
the only external user is the Translate extension, which could use the
OutputPage::addCategoryLinks() method instead, which has existed since
2014 (Id25041a7891f588ffa787fdd2c092342eecd30c8).
Deprecate this method with warnings.
Bug: T373480
Depends-On: Id25041a7891f588ffa787fdd2c092342eecd30c8
Change-Id: I7b07d761eb8cd5ad1e6da2dd836e969a0d492c2b
This is the second patch of a series of patches to remove
ParserOutput::getText() calls from core. This series of patches should
be functionally equivalent to I2b4bcddb234f10fd8592570cb0496adf3271328e.
This patch replaces the calls to getText where the legacy parser is
called directly by creating a pipeline and invoking it on the generated.
These should probably eventually use the Content framework to generate
output instead of using Parser directly (T371008), which will also allow
them to transparently support Parsoid.
Bug: T293512
Change-Id: I45951a49e57a8031887ee6e4546335141d231c18
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
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
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
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
And deprecated aliases for the the no namespaced classes.
ReplicatedBagOStuff that already is deprecated isn't moved.
Bug: T353458
Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
Versions are changed in 8e940c4f21,
but that makes the version wrong
Follow-Up: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
Change-Id: Iae43725b8e0fffc4d44bf57f6227334b41290bd9
This allows the deprecated formatPermissionsErrorMessage function to
start emitting deprecation warnings and be removed one day.
Change-Id: Iea190deacdadb3e6b242042cfacbb406b8d92f9a
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
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
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
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
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: Ia35b2d3105880631dd26ec974068b000ac7f4b6b