| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
In particular, add content model and render reason statistics.
Change-Id: I5286425794cc7827705bfc0e7f004543e383443c
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Why:
- ParserCache refuses to return cache entries for redirect pages. So we
shouldn't write these entries into the parser cache in the first
place.
- If we write but refuse to read, this means there will be a cache write
every time a redirect page is retrieved via ParserOutputAccess.
What:
- Make ParserCache:save() skip entries for redirect pages. This is
only reachable via "redirect=no" since by default MediaWiki
pageviews render the destination page instead.
Note:
- It seems we should be able to store redirect pages like any other
page in the ParserCache. Why we didn't, and whether we should, is
not yet clear. While this is being investigated we should establish
consistent behavior for get() and save().
Bug: T389591
Change-Id: I880997193d6de66121c902de80a77c1305bd01d3
|
|/
|
|
| |
Change-Id: I56b31870ce9be46d15fcd9095f9a12e0f2488ed9
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Note this is only test setup. It probably doesn't make a difference.
Still I found it quite confusing. The month is not zero based.
The behavior of the new formular is like this:
1 → 1
2 → 2
…
12 → 12
13 → 1
14 → 2
… and so on. I also made sure 0 wraps to 12, just to be sure.
Change-Id: I8eba45594f639e48293fe8b006bfc708321e1ae3
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Updated + added new unit tests.
* Also preserves <nowiki/>
Bug: T388819
Depends-On: Ie366443f15e9ecf2573f9a4902a36dbcb2d36143
Change-Id: Iab8e861d4b7dd86680f29602856e6710f0140e1c
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* In 387061415a38ea2d28e76ac9d7d599f6f02deec3, we added support for
StripState::split. In 8465c722, we added support for 'exttag' strip
marker which introduced the possibility of recursive strip
markers. This patch fixes the oversight and adds recursive
processing for nested strip markers. The code matches the logic of
unstripType. Verified on local wiki that this fixes the issues
highlighted in T387608.
* Ensure that processNowiki is true when fragment mode v2 is being
used (ie, when stripExtTags is false). This makes unnecessary the
StripState::replaceNoWikis() function added to support
mw.text.unstripNoWiki in T272507 (and broken in T387655). The
workaround can be cleaned up once v2 fragment mode is enabled
everywhere. This fixes a regression in Scribunto's
mw.text.unstripNoWiki function when v2 fragment mode is used.
* Ensure that the T299103 workaround for {{#tag:<nowiki>...</nowiki>}}
continues to work by calling unstripNowiki() after PROCESS_NOWIKI
puts the <nowiki> contents into the strip state. This fixes a regression
in {{#tag:syntaxhighlight|<nowiki>....</nowiki>}} when using v2
fragment mode.
* Added 'marker' to StripState::split() output, so that unhandled
strip state components can be left as strip markers.
* Added some StripState::split() phpunit tests.
* Changed ParserTestRunner to enable v2 fragment mode by default,
which helped identify the Scribunto and SyntaxHighlight regressions
above, covered by their parser test suites.
Bug: T387608
Bug: T387655
Bug: T272507
Co-Authored-By: C. Scott Ananian <cananian@wikimedia.org>
Co-Authored-By: Subramanya Sastry <ssastry@wikimedia.org>
Depends-On: I5e2533b7992b8e8a03fe2ea622b6fe5b008d20be
Change-Id: I43134281e4da1c8767520e418031935447ea93af
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This reverts commit 7f63d5250e8db443d8fce3016abd9757521b590d,
re-applying commit 82da9cf14be08e9458f58fa96be51966a2fe7cb1.
It can be re-applied safely after T354361 was fixed.
Most of the incidental changes from the original patch are
no longer needed, as they were made unnecessary by other work,
or were applied in I4cb2f29cf890af90f295624c586d9e1eb1939b95.
Change-Id: I1ff9a7c94244bffffe5574c0b99379ed1121a86d
|
| | |
| | |
| | |
| | | |
Change-Id: I0f8a8cac36015bba52aea3ee2affd92f83d3574a
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This allows Parsoid to mark parses which contain async content which
is "not ready yet". At the moment this output is cached with a reduced
TTL, although in the future it might still be treated as uncacheable,
cached until evicted, or some other option.
The HAS_ASYNC_CONTENT flag along with ParserOutput::hasReducedExpiry()
ensures that RefreshLinksJob is opportunistically reinvoked whenever
the page is reparsed, since the asynchronous content may change the
metadata for the page when it becomes ready.
As describe in T373256, ::hasReducedExpiry() is misnamed now, and a
follow-up patch will probably rename it to ::hasDynamicContent() or
something like that. What it really means is "RefreshLinksJob must
be re-run on every parse, because the content may change on each
parse". In the past we would *also* reduce the cache time for
pages like this. But for asynchronous content, "the content may
change on each parse" only *until* the asynchronous content is
"ready". Once it is ready the contents will no longer change, and
the cache lifetime can be raised again -- but ::hasDynamicContent()
still needs to be set, which in the future will mean "you need to
check that RefreshLinksJob has last run" not "you must always run
RefreshLinksJob".
Asynchronous content will always set HAS_ASYNC_CONTENT, even after
the content is "ready", but will only set ASYNC_NOT_READY if it
needed to use placeholder content in this render.
Bug: T373256
Change-Id: I71e10f8a9133c16ebd9120c23c965b9ff20dabd2
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Same as Ia294bf4 did for 1-line comments. This patch removes slightly
more complex 2-line PHPDoc comments that don't add any new information
to the code, but literally repeat what the code already says.
They say "don't document the code, code the documentation", and we
are doing this more and more. We just tend to forget to remove the
obsolete comments.
Note I'm also removing a line of text in a few cases when it's very
short and literally says the same as the method name. Again, such
comments add zero new information.
Change-Id: I01535404bab458c6c47e48e5456403b7a64198ed
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
I assume these are all either auto-generated by an IDE or the
language-level type declarations have been added later. In any case
the comments don't add any new information to what the code already
says. This is just extra clutter that makes the code harder to read,
I would argue.
There are many, many more comments like this. In this patch I
intentionally focus on the most trivial 1-line comments.
Change-Id: Ia294bf4ce0d8a77036842fe25884bc175c2b0e7d
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Avoid using Title in setupFakeRevision. This removes a blocker
for narrowing the return type of RevisionRecord::getPage() to
ProperRevisionRecord().
Bug: T380536
Depends-On: I54f75059f3d78100b393827db7bc25f253a559e8
Change-Id: I7cec5a47e269d3583306ff4ebd3123be500ec217
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This avoids dependencies on the internals of Parsoid's load/storage
mechanism for data attributes.
Documents should also not be "prepared and loaded" when running
parser tests, after d07ee3a694f3b3372aea690d9104d241082810fb in
Parsoid.
Depends-On: Ic3c09444cef51767629a9f7fac9e79351bb1fc48
Depends-On: I753bbbfaf99fb486384b0fa97de71159abb504b3
Depends-On: I07b8d6f6c3006d238093b756df418b645ebd532a
Change-Id: I9e6b924d62ccc3312f5c70989477da1e2f21c86b
|
|\ \ |
|
| | |
| | |
| | |
| | | |
Change-Id: I27b9a19ab952ede1267921bd042af0fe1c89e228
|
|\ \ \ |
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This deprecates a number of methods which returned arrays by reference and
exposed internal representation details of the ParserOutput. It also
regularizes the return values to return consistent LinkTarget values,
working around the wide variety of different internal storage formats
used for links.
In the future, once these methods which expose the internal representation
are removed, we can simplify our internal storage as well. But for the
moment we add the new getter without changing the internal representation.
Note that by returning TitleValue objects this new interface also provides
a means to fix the issue identified in T204792 where interwiki and namespace
prefixes were getting confused. A TitleValue properly distinguishes between
these -- although the callers will still have to be careful to use it as
a TitleValue and not attempt to reparse it.
These methods also correctly handle fragments, which are present for the
language link type but stripped for the other linkt types.
Bug: T204792
Change-Id: I48a2077b9645124f83082afd953d6bf7a861270b
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
Changes to the use statements and some additions
are done automatically via script
This also updates @covers tag for the namespaced classes
Change-Id: I859ba6d05018c99710b744e2becab432410d3bca
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| | |
Bug: T353458
Change-Id: If02cc9b1ff78e26c1cf8c91ee4695845eb133829
|
| |
| |
| |
| |
| |
| |
| | |
Also a few other fixes of PHP class aliases spotted by phan.
Bug: T353458
Change-Id: Ie79d65722c47c24f8f20f1293355cfd3c2e8c2ad
|
|\ \
| | |
| | |
| | | |
non-strings"
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This was deprecated in 1.42 but did not previously emit deprecation
warnings.
Depends-On: I072b111b047cfe13e32a822678d68165d1c76f84
Depends-On: I2734383207b92f71bffc66ba2392a592a1df0954
Depends-On: I79bb5030c13e83f664da1635254f4bc171ed4f3e
Depends-On: If64a5239a40953f244657e60f95b2e938abfe447
Change-Id: Ifefd3dab43247d988b7c7ff7874c05c90fc8ce1f
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
*Most* implementations of ContentHandler::fillParserOutput() ensure
that the returned ParserOutput has had
ParserOutput::resetParseStartTime() called on it at an appropriate
time -- but not *all*. This is a belt-and-suspenders fix that ensures
that every code path which creates a ParserOutput has *some* "start
time" defined. This could be misleading if the parsing is done first
and the parser output is created at the very end of the parse, but in
all the code that I've looked at the ParserOutput is the first thing
created and so this default should be reasonable.
While we're at it, remove the parseStartTime from the serialized form
of the ParserOutput, because it is useless after the object is
unserialized.
Bug: T376433
Change-Id: I3bdf3996401a7d5ac4d8e1e5e6afb7ca410cbe6c
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | | |
Bug: T353458
Change-Id: I3b736346550953e3b2977c14dc3eb10edc07cf97
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | | |
Unused since addition in 0127c7c446 (r80375)
Change-Id: I81544e367543846654b4d03fcad5adad71e23751
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For language links, when there are conflicts between namespaces and
interwiki prefixes, it is important to use TitleValue for language links
rather than to try to reparse the Title. Language links also preserve
fragments, unlike other link types in ParserOutput; added tests to
document this.
Added handling for interwiki links and template links.
Bug: T363538
Change-Id: I6e8ff8ed7f8819000cc3f80e49c0739b568217a4
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
|\ \ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Why:
* The REVISIONUSER magic word displays the username of the user
making the edit when the user is previewing an edit
* When temporary accounts are enabled, the user performing the
edit should see a temporary account name and not an IP address
to avoid confusion.
* This currently works as intended for all but the user's first
edit because, until they have submitted their first edit, they
have no temporary account. However, they should have a stashed
name for a non-existing account.
* Setting the ParserOptions user as the stashed name in this
edge case fixes the issue and should not cause unintended side
effects.
What:
* Update ParserOptions::newFromContext to use the stashed temporary
account name if all of the below are true:
** The current context user is an IP address
** Temporary account autocreation is enabled
** The user has a stashed name defined in their session
* In all other cases the user used in ParserOptions::newFromContext
is unchanged.
* Add tests for ParserOptions::newFromContext to verify these
changes and to avoid regressions.
Bug: T372723
Change-Id: Ie532aa997a59cbf5204a554bd087ba7451f7d47a
|
|/ / /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Before a test is started there are no services, there is no need to
reset services in setUp().
After a test finished all created services are destroyed by
MediaWikiIntegrationTestCase and does not need own teardown.
overrideConfigValue() also resets services
Change-Id: I41c71866ec6d93cd2b7e3dd45269e0972ed6a273
|
|/ /
| |
| |
| | |
Change-Id: Id7ccd48e3bf626095e2d3929831b5d87ed0be948
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
With the precise expiration computation for magic words like
{{CURRENTYEAR}} there's the potential for all the pages which
use (say) {{CURRENTYEAR}} to expire at the exact same time,
causing a cache stampede.
I9acb42b0d9ff67798a1624cbf9c7cac99c8fbe2f added code to "randomly"
stagger the cache expiration:
$ttl += ( $deadlineUnix % self::DEADLINE_TTL_STAGGER_MAX );
However, this "stagger" was not actually random, since it is
based on the computed deadline. So all of the pages which use
{{CURRENTYEAR}} will all compute the same `$deadlineUnix` (midnight
of January 1st of the next year) and thus compute the same "stagger".
Change $deadlineUnix to $tsUnix so that the stagger is based on when
this particular page is being parsed, which should actually have
the desired effect of spreading out the possible cache stampede.
Followup-To: I9acb42b0d9ff67798a1624cbf9c7cac99c8fbe2f
Change-Id: I95272e301c00e4646dd29ca22abc26c6cbe9028e
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is the first patch of a series of patches to remove
ParserOutput::getText() calls from core. This series of patches should
be functionally equivalent to I2b4bcddb234f10fd8592570cb0496adf3271328e.
This first patch replaces the calls to getText to calls to
ParserOutput::getRawText when the pipeline has no reason to be executed.
Bug: T293512
Change-Id: I0ad53cd074ca9cf13e96e6b08179e13aeea180f4
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The main benefit is that this syntax avoids repeating the variable
name. It does the same as before.
Change-Id: I2040be889c749f4e2416ca9948ba261345858af2
|
| | |
| | |
| | |
| | |
| | | |
Bug: T353458
Change-Id: Id3202c0c4f4a2043bf97b7caee081acab684155c
|
| |/
|/|
| |
| |
| | |
Bug: T353458
Change-Id: Ifa3b6a6e0353bb4ce21a3f4456f1fc696c8d377c
|
| |
| |
| |
| |
| |
| |
| | |
It adds MediaWiki\Content namespace to WikitextContent
and two classes related.
Change-Id: Ib74e4c5b3edac6aa0e35d3b2093ce1d0b794cb6d
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
get_debug_type() does the same thing but better (spelling type names
in the same way as in type declarations, and including names of
object classes and resource types). It was added in PHP 8, but the
symfony/polyfill-php80 package provides it while we still support 7.4.
Also remove uses of get_class() and get_resource_type() where the new
method already provides the same information.
For reference:
https://www.php.net/manual/en/function.get-debug-type.php
https://www.php.net/manual/en/function.gettype.php
In this commit I'm only changing code where it looks like the result
is used only for some king of debug, log, or test output. This
probably won't break anything important, but I'm not sure whether
anything might depend on the exact values.
Change-Id: I7c1f0a8f669228643e86f8e511c0e26a2edb2948
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This code was partially copied into MassMessage and will hopefully
enable more places that accept arbitrary wikitext to check lint errors.
It also hides the internal details of checking with the Linter
extension's configuration in one place until it can be refactored into
something more acceptable (T360809).
Bug: T368690
Change-Id: Iaeb3ccbd61a2a8cb0d8b3dc8b06a3a10bc8fa653
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A single test function can have multiple @dataProviders. No problem.
A @dataProvider can also be used by multiple test functions. No
problem. No need to duplicate such large pieces of code when it's
identical anyway.
Change-Id: I5aea36304ec2d1666ff2334ba883df07a70c15c5
|