| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| | |
Bug: T353458
Change-Id: If02cc9b1ff78e26c1cf8c91ee4695845eb133829
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
|
|
| |
Some fixes done via codesniffer fix (Ibd0f48e14e)
Change-Id: I0404ceca7c5abe8d32ef9a8fce404c7b89ffbaae
|
|
|
|
| |
Change-Id: I35d6e3181ed885b8731ff1c4b5703459fb4223e4
|
|
|
|
| |
Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Bug: T166010
Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
|
|
|
|
|
|
|
|
|
|
| |
Same as I7a82951.
overrideConfigValue() and overrideConfigValues() both call
setMwGlobals(), which calls resetServices(). This is surprisingly
expensive. It's much better to call it once with an array.
Change-Id: I4ff2f6b902b1a1e0b554ce6fc76f3b612f703fae
|
|
|
|
| |
Change-Id: I21b9bf907e313947360b1607f11ae9917488f109
|
|
|
|
|
|
|
|
|
| |
Initally used a new sniff with autofix (T333745),
but some provide are defined non-static in TestBase class
and need more work to make them static in a compatible way
Bug: T332865
Change-Id: I889d33424f0c01fb26f2d86f8d4fc3de3e568843
|
|
|
|
|
|
|
|
| |
Turns out this method is rather expensive because of the final
resetServices() is does internally. It's much better to call it with
an array.
Change-Id: I7a82951e281512d535ffc5a86929f4441f3ddc4e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Consolidate cache TTL handling within CoreMagicVariables.
Make the TTL account for how many seconds away the value is from changing.
For example, CURRENTHOUR should change soon after the next hour is reached.
There is a minimum adjustment TTL to avoid parser-after-save delays.
This allows for longer caching in most cases, as well as more up-to-date
rendering when the hour/day/week/year is about to change. Previously, there
were blind TTLs, which are either way too pessimistic or way too generous.
This commit does not change the CURRENTTIME, CURRENTTIMESTAMP, LOCALTIME,
and LOCALTIMESTAMP words, since there is no reasonable way to cache output
while keeping them up-to-date.
Bug: T320668
Change-Id: I9acb42b0d9ff67798a1624cbf9c7cac99c8fbe2f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is moderately messy.
Process was principally:
* xargs rg --files-with-matches '^use Title;' | grep 'php$' | \
xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1'
* rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \
xargs rg --files-with-matches 'Title\b' | \
xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1'
* composer fix
Then manual fix-ups for a few files that don't have any use statements.
Bug: T166010
Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a
Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
|
|
|
|
|
|
| |
Avoid parsing known titles in tests to improve performance
Change-Id: Ibfccfe696f0b8bfda0b99abae324e60bbecef7d8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Code search:
https://codesearch.wmcloud.org/deployed/?q=-%3E%28mLinkID%7CmIncludeSizes%7CmDoubleUnderscores%7CmShowToc%7CmRevisionId%7CmRevisionTimestamp%7CmRevisionUser%7CmRevisionSize%7CmInputSize%7CmInParse%7CmFirstCall%7CmGeneratedPPNodeCount%29&i=nope&files=&excludeFiles=&repos=
The following @deprecated properties are not included in this patch in
order to keep it conservative:
* Hard to code search because of generic name:
$mTitle, $ot, $mOptions
* Should be @internal, not @deprecated, because they are used internally:
$mPPNodeCount, $mHighestExpansionDepth
* Used by SyntaxHighlight_GeSHi and TemplateStyles extensions (even though
they could/should use their own independent unique ID):
$mMarkerIndex
* Used by test cases for Wikibase:
$mExpensiveFunctionCount
Change-Id: I1dadff934ead767cbd25615c08768e8e935d6b2e
|
|
|
|
| |
Change-Id: I38299cb65eeaadfdc0eb05db4e8c0b0119cfb37d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: Ic663e81cca0bf007804a70772250914a85f1fef4
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)
My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.
Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
This allows them to be more easily reused by other Parser implementations
(ie, Parsoid), and helps keep Parser.php compact.
Bug: T236813
Change-Id: I68fb1e786374e445b7df047934c532d7e10b8e94
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Parser::Options(), Parser::OutputType(), and Parser::Title() have been
deprecated. All of these had incomplete replacements with either a
::get* method or a ::set* method (and in the case of Title, both).
Add the missing getters or setters where required.
Only Parser::Title() has been hard deprecated. Replacing the other
uses in deployed code requires the newly-added Parser::getOutputType()
or Parser::setOptions() methods, so we can't replace those methods in
our deployed code after this patch has been merged.
Code search:
https://codesearch.wmflabs.org/deployed/?q=-%3E%28OutputType%7CTitle%7COptions%29%5C%28&i=nope&files=&repos=
Bug: T236809
Change-Id: I0b4d5f170216597afb259cedbb13b8028d284715
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These were deprecated in 1.34, but let's put in some hard deprecation
warnings for 1.35 since this class is certainly going to be refactored
in the future to allow both the legacy parser and Parsoid to extend
Parser as a base class. Access via the ParserFactory will be fine,
but cut down on the number of different ways Parsers can be constructed
and initialized.
Code search:
https://codesearch.wmflabs.org/deployed/?q=new%20Parser%5C%28&i=nope&files=&repos=
https://codesearch.wmflabs.org/deployed/?q=getMockBuilder%5C%28%20Parser%3A%3A&i=nope&files=&repos=
https://codesearch.wmflabs.org/deployed/?q=new%20Parser%3B&i=nope&files=&repos=
Bug: T236811
Depends-On: Ib3be450c55e1793b027d9b4dae692ba5891b0328
Depends-On: I9d16513f8bd449a43b0a0afbd73651a5c0afa588
Depends-On: I74efda708470efeb82f8f80346ec1ee7e9fd8f2b
Depends-On: I777475d0ab0144e53240173f501d6c8da35d33fb
Change-Id: If36283ec0b78b188b61f658639105d1ed7653e0a
|
|
|
|
|
|
| |
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
|
|\
| |
| |
| | |
release)"
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The following public methods were renamed and made private; the old name
is hard-deprecated and calls the new renamed private method:
Parser::doMagicLinks() => handleMagicLinks()
Parser::doDoubleUnderscore() => handleMagicLinks()
Parser::doHeadings() => handleHeadings()
Parser::doAllQuotes() => handleAllQuotes()
Parser::replaceExternalLinks() => handleExternalLinks()
Parser::replaceInternalLinks() => handleInternalLinks()
Parser::replaceInternalLinks2() => handleInternalLinks2()
Parser::getVariableValue() => expandMagicVariable()
Parser::initialiseVariables() => initializeVariables()
Parser::formatHeadings() => finalizeHeadings()
Parser::test{Pst,Preprocess,Srvus}() => fuzzTest{Pst,Preprocess,Srvus}()
Additionally, the following methods are not used externally, but are
used outside the Parser class by core code. They have been marked
@internal:
Parser::doQuotes() (used by {{#displaytitle}}),
Parser::getExternalLink{Rel,Attribs}() (used by Linker),
Parser::normalizeLinkUrl() (used by Special:LinkSearch and elsewhere).
Parser::{brace,arg,extension}Substitution() (used by PPFrame)
Code search query:
https://codesearch.wmflabs.org/deployed/?q=do%28MagicLinks%7CDoubleUnderscore%7CHeadings%7CAllQuotes%29%7Creplace%28ExternalLinks%7CInternalLinks%28%7C2%29%29%7CgetVariableValue%7CinitialiseVariables%7CformatHeadings%7Ctest%28Pst%7CPreprocess%7CSrvus%29%7CdoQuotes%7CgetExternalLink%28Rel%7CAttribs%29%7CnormalizeLinkUrl%7C%28brace%2Carg%2Cextension%29Substitution&i=nope&files=&repos=
Bug: T236810
Change-Id: I19a43ffc5dcfdd2981b51079c33422c964acb076
|
|/
|
|
| |
Change-Id: I11f8801ef47ec1a1f63d840116e69667e6f3ae3c
|
|
|
|
|
|
|
|
| |
This changes behavior in some tests by making them set $wgLanguageCode
as well as $wgContLang, but that seems like a good thing.
Bug: T200246
Change-Id: I936888f46ff9fefe2707efba837e2ce3a7ca5e3f
|
|
|
|
|
|
| |
Remove @group from non tests
Change-Id: Iae9ee3bc5f539a9b4ded8374006ab2993234450e
|
|
|
|
| |
Change-Id: I9116598bee4f4917e02290d273644c13475ff721
|
|
|
|
|
|
|
|
|
|
| |
Per wikitech-l consensus:
https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html
Notes:
* Disabled CallTimePassByReference due to false positives (T127163)
Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
|
|
|
|
| |
Change-Id: I048ccb1fa260e4b7152ca5f09b053defdd72d8f9
|
|
|
|
|
|
|
|
|
|
| |
These tests all involve database access in some way,
and thus need @group Database tags.
These failed when setting a bogus database password
and then running the tests.
Change-Id: I7f113a79ac44d09d88ec607f76b8ec22bc1ebcf1
|
|
|
|
|
|
|
|
|
| |
- Swap "$variable type" to "type $variable"
- Fixed spacing inside docs
- Makes beginning of @param/@var/@throws in capital
- Changed some types to match the more common spelling
Change-Id: Ia041964250d8b7c0349d79dc9b131c5b8696e795
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This test was causing failures locally when wgServer != localhost
because {{SERVERNAME}} is derived from wgServerName, not wgServer
and the test is only mocking wgServer.
> MagicVariableTest::testServername.. with data set #2 ('//localhost/')
> Magic servername should be <localhost:string>
> Failed asserting that two strings are identical.
> --- Expected
> +++ Actual
> @@ @@
> -localhost
> +krinkle.dev
This value is no longer derived by the Parser, but is instead
set using wfParserUrl in Setup.php.
Remove this obsolete test and add any missing test cases for
wgParserUrl to its test suite.
Change-Id: I7d7d201cb46841e63dac8ab9fd81b45b252264a3
|
|
|
|
| |
Change-Id: I69f17bf2af45f03274fdb38853184880e46c3514
|
|
|
|
|
|
|
|
|
| |
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.
Change-Id: Ic8aaf0a93796b97d0fa4617c1f86ff59f4b36131
|
|
|
|
|
|
|
|
|
| |
- Give methods scope
- Make providers static
- Add @covers todo
- Merge the Providers file that is only used in here
Change-Id: I60a6bbd5a8ad3d9d414de493ec2b083f52114a7b
|
|
|
|
|
|
|
|
|
|
| |
That apparently caused bug 46397.
This reverts commit 388b14a15de6c531d876796dde02605f046fcf53
Bug : 46397
Change-Id: Ideaa86f0d535873a08e27d6f98f6bd4255b8c594
|
|
|
|
|
|
| |
Setting a global 3 times in one test method looks weird
Change-Id: I97f6a932ee2d5c9a5e427cf0f40ced730b7e12ec
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Also add LinkCache::addLinkObj() calls to isRedirect(), getLength() and getContentModel()
- Changed error messages when LinkCache returns null, since this really should not happen anymore
- Removed incorrect comments
- Only use the value of the member variable if GAID_FOR_UPDATE is not passed
(for consistency between the three methods)
- Mark tests that need database access as such due to the call to Title::getContentModel()
(generally called through Parser::getFunctionLang())
Change-Id: I84e0c47cdf7412f2b7fa5f296d066b64b7bbfd42
|
|
|
|
|
|
| |
6 of n.
Change-Id: I0ca3f1f72349623631ce1d7f3a4e2ed5edbdbdf4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix almost all occurences of the following sniffs:
Generic.CodeAnalysis.UselessOverridingMethod.Found
Generic.Formatting.NoSpaceAfterCast.SpaceFound
Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma
Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine
Generic.PHP.LowerCaseConstant.Found
PSR2.Classes.PropertyDeclaration.ScopeMissing
PSR2.Files.EndFileNewline.TooMany
PSR2.Methods.MethodDeclaration.StaticBeforeVisibility
Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Setting $wgContLang without changing $wgLanguageCode accordingly is a
very bad idea.
This caused about 20 exceptions when using LanguageCode set to 'fr'
on my installation:
"MWException: Error in MediaWikiLangTestCase::setUp(): $wgLanguageCode
('fr') is different from $wgContLang->getCode() (en)"
Follow-up of I2987db68 (2b0edc8).
Change-Id: I56d3f1bfc78d6a2e40460533524e82f360490206
|
|
|
|
|
|
|
| |
This avoids using $wgUser and $wgLang for the ParserOption, which is not
needed in the tests
Change-Id: Iea07e9a0f0898ec5f8eb98a40000f5d33b279c9e
|