This defaults to SlotRecord::MAIN, which is what it should be rather than RevisionRecord::RAW
Bug: T294043
Change-Id: Ib035fe4eea778747f47a476c8aa2cfaab44aa7d8
Fixes checkStorage.php --fix
* importRevision() is required to be public for WikiImporter::setRevisionCallback()
* $revision must not be passed by reference
* $importer is unused, so removed
Change-Id: I53ef3825308af3b6e632cb88b9a3eb2f40ab5239
For use in the checkStorage and resolveStubs maintenance scripts, in order to fix them.
Follows-Up: Id1f530c2c8ec1171615f726dc7446431ee7ca8fe
Change-Id: Iade3d1660f2b7db62f829f5e5ca94372614ae7e5
Apply prefix and suffix to invalid titles just like it's applied
to conflicting titles. (Typically this will be needed when the
Foo namespace is created and there is a Foo: article already.)
Also remove a broken for loop. Presumably the intent was to
repeatedly add prefix/suffix on conflict, but actually it would
just get into an infinite loop. The behavior doesn't seem that
useful anyway.
Bug: T293407
Change-Id: Ieef6698b461e7db003dc326e5cd82accd2909540
I intent to remove Profiler::getContext/setContext after a week
without deprecation. I consider these methods as internal (they
predate the stable interface policy, and we forgot to triage this
class, it has neither `@stable` nor `@internal`).
The hard-deprecation in this commit is to detect any use that may
have gone unnoticed in WMF production from Codesearch analysis alone,
where no usage was found.
Bug: T292269
Change-Id: Id40679f21cc7a3f77a1b96a4bbd55daeaea16892
This script is used to rename things to prepare for unicode
update. The script does not rename the users, instead it generates
a list of users to be renamed with renameInvalidUsernames.php,
but this script output is incompatible with the other script input.
It would be more convinient to be able to directly feed the result
of this script as input to the other script.
renameInvalidUsernames.php expects input as TSV with domain, user_id,
new_user_name. That's what we want to output. Also opening the
output file in append mode is more convenient - that way we can
collect all usernames for renames for all wikis when running
the script with foreachwiki
Bug: T219279
Change-Id: I27e182247d55c635e75027065546285be74934b6
* Document that Maintenance::shutdown is the CLI equivalent of
MediaWiki::restInPeace.
* Centrally document in the emitStats method why we flush stats
regularly, and clarify that these OOM concerns are specific to
CLI processes there. That isn't to say it could never happen on a
web request, but all our early flush handling (even DB trx hooks)
are explicitly limited to command-line mode today and always have
been.
* Ref T253547. It is now clear why --profiler=text doesn't work on
the CLI (it is missing the non-external profiler output handling),
which I'll fix in a follow-up.
* Ref T292269. The WebRequest-dependency in Profiler is now much more
clearly problematic. Previously this was masked by wfLogProfilingData
effectively silencing the warning on the CLI without it being so
obviously wrong. I'll fix that in a follow-up.
* Ref T292253. All this is already post-send, and flame graphs confirm
that we don't have any calls to emitBufferedStatsdData nor
StatsdClient::send apart from the post-send one via restInPeace.
Bug: T253547
Bug: T292269
Bug: T292253
Change-Id: If78c37046cf8651c7a8d6690e01d38c3ca29d8d8
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
Since the branch cut has happened, we can bump and get rid of legacy
cruft. According to the policy we can go up to 1.31 but let's keep it
that way to avoid major distruptions.
Change-Id: I9d697445a3bb5047726c8b2a7f808edb8403cdda
Use 0 instead of "" to signal an unchanged character. 0 is only one
character and "" are two characters. This reduces the uncompressed size
of the JSON file by 770 byte.
Change-Id: Ibb6d2d1d9af712ad73733d3179fb82751028e054
This is just moving code verbatim, removing now-unneeded stuff, and
duplicating tests as well.
Bug: T290021
Change-Id: I540ddaaa11dfabcf0b87b608b151b5e34d199fd8
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.
It is only data changes and only works for Chinese WikiProjects.
Change-Id: I14fc68ae8f6792e24127aaa93f6fe7aa1f786a26
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
== Background
During a parse request [1] for a popular Wikipedia article, there
are 180,949 calls to MapCacheLRU::has and 188,542 calls to
::getCurrentTime via ::getAge. (Note, getCurrentTime has more calls
than ::has, as there are also calls via ::set and ::setField).
In a one-off XHGui profile, these calls had 246ms wall-time or 258ms
cpu-time attributed to them, which is 0.25s of a 12s parse or 2%.
In a day's worth of index.php samples [2] [3], there is 1.1% cpu-time
or 1.4% wall-time attributed to MapCacheLRU, of which ~0.3% in
getCurrentTime() alone.
== Change
Most uses of MapCacheLRU are without any in-process TTL, and thus have
$maxAge at its default of INF. Avoid calling getAge and getCurrentTime
in that case.
I think long-term it might make sense to deprecate the TTL feature
in MapCacheLRU, as it is very very rarely used, and still adds
significant overhead to all uses MapCacheLRU and its set() code path.
For cases where in-process TTLs are really needed, the HashBagOStuff
class could be used instead. I can't find any complex uses of
get/setFields, let alone with per-sub field TTL, but a theoretical
or third-party use case could potentially use HashBagOStuff with
sub-fields either as their own key, or refactor to put arrays under
a single key and TTL, or re-create it in their own code base if really
needed.
== Difference
I've added a benchmark since generating random values and populating
MapCacheLRU seems non-trivial enough to be worth a re-usable bench.
Using `benchmarkLruHash.php --method get --count 1000`, before:
> MapCacheLRU::get with 500 keys
> count: 100
> rate: 28.5/s
> mean: 35.06ms
... and after:
> count: 100
> rate: 35.6/s
> mean: 28.10ms
[1] POST en.wikipedia.org /w/api.php?action=parse&title=Barack_Obama&text={{:Barack_Obama}}
[2] https://performance.wikimedia.org/arclamp/svgs/daily/2021-09-06.excimer.index.reversed.svgz
[3] https://performance.wikimedia.org/arclamp/svgs/daily/2021-09-06.excimer-wall.index.reversed.svgz
Bug: T275673
Change-Id: Id8c747f0d0a9454274c296090a2ca80e440f97bb
This helps phan to detect unreachable code and also impossible types
after the functions.
It helps phan to avoid false positives for array keys
when the keys are checked before
Bug: T240141
Change-Id: I895f70e82b3053a46cd44135b15437e6f82a07b2
This patch injects services into WikiExporter. It also adds a
WikiExporterFactory service for creating WikiExporter instances.
Change-Id: Ib1547defea54c309865c116bc83d617c21568843
Use ObjectFactory specs for collation classes
Avoid the language construction in the factory class,
make it a detail of the implementation of each class
Follow-Up of Ifc96f851e6091ce834dbaf0e91695c648a42169c
Bug: T286079
Change-Id: Ib581f64aec8619986fb8dd49ceee0524d59a1b84