Switch test case with services to use a
service other than ObjectFactory, to make
it easier to mock.
Change-Id: I374a516b6bcc8111b2432245faf935f8287d45a7
- JavaScriptMinifier: The public interface for this internal class is
ResourceLoader::filter which, except for one caller (minify.php)
is indeed consistently used already, no other callers need replacing.
- CSSMin: Idem for minification, however, this class has some other
method as well, which have a number of internal users, but none
outside core. These have all been replaced in this commit.
- Remove pear/net_url2 as own dependency as this was only used by CSSMin
and recently added there. This is now a dependency of wikimedia/minify
instead. This was not part of the public API and no longer mentioned
here in composer.json or RELEASE-NOTES. (It remains pinned in
mediawiki-vendor, however.)
Bug: T273247
Depends-On: Iadff8c2112d5e53bd994ab4882006e8c644a2379
Depends-On: Id3c6dcc0b952a9efe34b3a9ed88b716101a51f87
Depends-On: I589be910f57289fd908b22db87241b0e52da60d4
Change-Id: I8d71fc64aeecdb31db218b02e361ae9bb0d19b48
I keep fixing type hints in my local dev environment whenever I
see something that is worth updating. This is what I collected
over the past weeks.
Change-Id: Ia4f1b4bee2019abe4ab0fb0df8164e1b446229e7
Using a random id as the cache key is useful in that it ensures
we don't poison ourselves with results from unrelated closures,
but it also prevents any use of APCu caching beyond the current
web request which is kind of what it is for.
There is a subclass inside the test case that stores results
in-process with an array instead, but for things like that we
generally use in-object caching of class instances, or
HashBagOStuff::getWithSet, or MapCacheLRU::getWithSet.
Change-Id: I264ad87af25dda4cde0c71aad83b30c314f8cd8d
This is micro-optimization of closure code to avoid binding the closure
to $this where it is not needed.
Created by I25a17fb22b6b669e817317a0f45051ae9c608208
Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
This reverts commit 4e94fa8812.
The extra serialization call here is not needed since storing
a value naturally results in serialization and thus exception
throwing already (hence the fatal error at T273242).
Performing serialization twice comes with a significant cost,
which has in past led to notable regressions.
Adding a try-catch makes sense, but this can be placed at a
higher level instead, as is already done by Ibfcbf0eceb4b7a36
which was already merged and back-ported, making this obsolete.
Other use cases:
- Continuous integration where HashBag is used, which doesn't
need serialize and thus doesn't cover the Closure issue.
Cost of serialize was removed there for performance reasons,
but if we want to add it back, let's do so there in the natural
place where it once was (or in MediumBag, which might be preferable
so that we can use that same code path to gradually switch to JSON
encoding and warn/throw for non-jsonic values).
- Regular getWithSet calls (rather than the async refresh from which
the fatal is currently seen). For regular getWithSet calls we already
get a useful stack trace that points directly to the line of code
where the value and cache key are computed, so additional logging
does not seem that valuable. But for consistency we could move the
try-catch from Ibfcbf0eceb4b7a36e33a8 a little lower to cover all
fetchOrRegenerate() calls, not just those from scheduleAsyncRefresh.
Bug: T273242
Change-Id: Ic649016dde7b58323a028ce6d4fe617ef62a1ff8
If we pass mock datetime in the data to be formatted, the
formatter will use it, so the time string will no longer vary.
Bug: T218688
Change-Id: I4ea846cf1e908de085a551bda2bd944e846f7a36
The ActorNormalization factory methods create
UserIdentityValue from the database rows, either via
fields of a joined table, or via a row from actor table.
They assume that the actor_id exist and throw othervise.
ActorNormalization is a storage-layer service providing
access to finding and acquiring actor_id.
The UserIdentityLookup methods do not instantiate new actor
on demand, they just find an appropriate row in the actor
table and return the result.
Bug: T272689
Depends-On: I74d81f3f0233efb17fc8df5178e4c477cc669c6f
Change-Id: Icfa1daca960c696a8cef8adab5eab53985802858
This new hook provides for the use case in T47096 (allowing the
Translate extension to transclude a page from another language) by
adding a new hook which would let us deprecate and replace two awkward
legacy hooks (one with an embarrassing capitalization issue). The new
hook is a little more tightly scoped in terms of what it allows and
gives access to, and it uses the new RevisionRecord API.
In addition, the new hook uses LinkTarget instead of Title per
current best practices. (PageIdentity is not appropriate for
reasons documented at the hook invocation site.)
The original BeforeParserFetchTemplateAndtitle (sic) hook allowed
redirecting the revision id of a template inclusion, but not the
title. The only known current use is Extension:ApprovedRevs; the
FlaggedRevs extension replaces the entire function using
ParserOptions::setCurrentRevisionRecordCallback().
Extension:Translate would like to redirect the title as well, possibly
recursively (for a limited number of hops) to handle fallback
languages. That is, when invoked on Foo/fr, including Template:Bar
would redirect to Template:Bar/fr -- and, if that doesn't exist, then
Template:Bar/fr would redirect to its fallback language, say
Template:Bar/en. It uses the top-level page title as context to set
the desired page language. This would require 2 invocations of the
hook; we've set the recursion limit to 3 to provide a little bit
of future-proofing.
The hook added in this patch uses RevisionRecord instead of int
$rev_id, and thus can handle the case where the redirect is to a page
which doesn't exist (by setting the RevisionRecord to a
MutableRevisionRecord with the correct title and no main slot content)
in the fallback language case above.
The new hook deprecates BeforeParserFetchTemplateAndtitle and replaces
ParserFetchTemplate as well (deprecated in 1.35). Code search:
https://codesearch.wmcloud.org/search/?q=BeforeParserFetchTemplateAndtitle&i=nope&files=&repos=
Bug: T47096
Change-Id: Ia5b5d339706ce4084c16948300e0e3418b11792e
Make Command extend Shellbox's UnboxedCommand. Only a few MediaWiki-
specific features remain in the subclass.
Also add BoxedCommand abstraction and Shellbox client.
The Result alias didn't actually work, I just had to change the return
type hint.
Bug: T260330
Change-Id: Iff7428e4c5fe3959a5cda8e113f223caa0976fc1
Since there is the testGetIdDeprecated() test case which tests that the deprecated functionality still works in RevisionRecordTests trait. So the new testGetIdTriggerDeprecatedWarning test case was added in order to check triggering of the warning in RevisionRecord::getId() method.
Bug: T273314
Change-Id: I7248bfa5ed8b485ea79929a3bd5f8db0156c3201
Soft deprecated since 1.31, no need for hard deprecation
since it is unused and not stable to create
Change-Id: Ie854f422870e1f7666566544d4ed5df9abe240fb
TextContent/WikiTextContent can actually get to initializing
the global service container, which is not good.
Change-Id: I418d0a839fc3cd154d6d02af865e53564e2805ed
BagOStuff has a debug mode because MemcachedClient has a debug mode,
because Ryan T. Dean put one in there in 2003. It's not strictly
necessary now that we have log levels.
This means that a few existing $this->logger->debug() calls are now on
the same effective level as $this->debug() calls, they can't be enabled
separately. But that seems inconsequential.
Change-Id: I4d1cb9153559b29468b6ca530bbc56e2b35d1721
Update SQL, REST, and redis subclasses to emit call count and
payload size metrics for cache key operations. These metrics
are bucketed by cache key collection (similar to WANCache).
Bug: T235705
Change-Id: Icaa3fa1ae9c8b0f664c26ce70b7e1c4fc5f92767