Currently, MediaWiki avoids CDN caching if the URL is not among the list
of canonical URLs that we purge, which can cause all sorts of issues
including caching being extremely narrow.
ViewAction is cache invariant and better to be cached unconditionally.
This effectively undoes part of Ie38ae198b1735339371 (2012). Similar
to the existing setCdnMaxage() calls, this is not expected to risk
caching of private information given that a separate layer is
responsible for deciding whether caching is "safe" from an application
point of view. Callint setCdnMaxage() does not affect whether CDN
caching is allowed, its just that the default maxage is 0 for cases
where it is safe, and this change effectively raises it to 1h for
arbitrary URLs that effectively route to action=view, including e.g.
diff URLs and oldid URLs, but e.g. not any other action parameters.
Bug: T309063
Change-Id: I468caa8fd4baf650b419572b77b3df64ae72780d
SessionBackend::save() results in the session provider unpersisting
when the session backend metadata is dirty (which is always true
for a new session). This breaks the tombstone mechanism introduced
in I3a76b67aa51159ebf0195db15cf7c34e00a64a2e: after the manager
refuses to load the tombstoned session, it will create an empty
session, and that will unpersist the session ID and log the user
out if the session ID was the only thing that kept them logged in.
Saving the session has two effects: the unpersisting (invalid
cookies are cleaned up) and saving the session data in in-process
cache (but not the real storage). The latter might cause an extra
session storage read per unauthenticated request, though in theory
it shouldn't as the SessionBackend itself gets cached so a new
session lookup only happens for a different WebRequest object.
Still, if it becomes a problem, we can just add some sort of
explicit cache warming step to empty session creation.
Skipping the unpersisting could mean that invalid (e.g. expired)
session cookies stick around and prevent the user from being
served from edge cache. But for non-tombstoned requests, as long
as there is a syntactically valid session ID and either no user
ID or a user ID pointing to a valid user, CookieSessionProvider
will return a non-null session info, and SessionManager will
reject it and unpersist; and CentralAuthSessionProvider behaves
similarly except for the case when there is no local session
cookie but there is a global session cookie on the second-level
domain. That seems a narrow enough edge case to ignore.
Bug: T299193
Change-Id: Ib34a84d1d3abbce4dcf7433b51abf6e694984c59
As a means of understanding the usage of the stash FEAT for
/page/html & /revision/html endpoints used by VE extension,
this patch introduces the collection of stats using the
StatsDataFactory.
Bug: T309017
Change-Id: I4e17d50e79da263637bdd55ab62e993df441fe38
Follows-up I56a0ee74595404e1, I38a0761ae4633 and I6c3d186de1877f73d4.
Remove most "Usage" examples as these are internal and
mostly-normalized class fields. This is not where end-users should
look for documentation. Besides, many of the examples were wrong or
outdated, and almost all were incomplete. It also had an inherent
dilimma between describing all possible valid input and describing
what we actually store in that instance variable after normalization
in the class constructor. The usage docs have long been moved
to the MW config file, so we can omit that.
In its stead, place more complete and accurate type hints for Phan
to understand the possible code paths, in particular to reflect
the use of FilePath objects.
Change-Id: I1cc002f350785d3f46f79be5defb7b3cadbebf34
All revision related classes are namespaced MediaWiki\Revision
instead of MediaWiki\Storage since 1.32. The old namespaced
class names are deprecated and only kept for backwards-compatibility.
Bug: T305784
Change-Id: I48cdc65301a8cd20d2bedd031dbdae33b8c2a34d
Some subclasses, like APCUBagOStuff, use the whole cache value itself
as the CAS token. Previously, in such cases, an error would be thrown
when the key held a PHP object, and the comparison would fail if the
key held an array that contained an object.
Make RedisBagOStuff and HashBagOStuff return null CAS tokens if the
value is false, to match other subclasses.
Make WinCacheBagOStuff CAS tokens distinguish int and digit strings.
Change-Id: I797f036e53aae7a4fdcb8586fbd4ebdbd7e8bae3
ResourceLoader's FilePath is designed to allow a FileModule
to include files that exist outside of the module's localBasePath,
to allow skins and extensions to extend core MediaWiki modules.
This is accomplished by having the FileModule use the FilePath's
localBasePath instead, in FileModule::getLocalPath.
(Similarly for remoteBasePath, but these are going out of fashion.)
However, the code processing 'packageFiles' did not handle this right:
it used FilePath's localBasePath when it appeared as a 'file',
but not when it was returned by a 'callback' or 'versionCallback',
using the FileModule's localBasePath instead in that case. Most
existing uses of FilePath in 'packageFiles' required the same base
path as the module, so it was convenient to avoid providing it twice.
To keep that convenience (already relied on by some extensions too)
while also allowing skins and extensions to add files from their own
directories to existing modules, the code processing 'packageFiles'
now uses FilePath's base paths in all cases, but they are optional,
and will fall back to the FileModule's paths when not provided.
Follow-up to 2890bca27d.
Change-Id: I38a0761ae4633a567b685b52c1d73b6ce280ffb7
It's not called by anything since it was removed from
ChronologyProtector, and it is not needed for production.
Pass the timeout directly to LoadBalancer::waitForAll() instead of
using a WaitConditionLoop, as it was before e99bb1b7dc
Change-Id: I5a1903e6e9ac145c06f77c690a0f6a487b4aa43f
Substantive changes:
* Remove the parameters globalKeyLB and localKeyLB, not needed in
production, probably not used anywhere.
* Add a "cluster" parameter, for production.
* Don't call markServerDown() in LoadBalancer mode.
Style changes:
* Document config parameters separately from constructor parameters, to
clarify the role of the wiring normalisation.
* Inject a load balancer from ObjectCache to SqlBagOStuff, using a
closure to defer construction.
* Clarify the split between LoadBalancer mode and server array mode by
introducing a useLB property. Use it instead of special shard index
values and array counts.
* multiPrimaryModeType wasn't needed anywhere and wasn't available in
the constructor, so it just became a boolean multiPrimaryMode.
* Add a test covering most of the server array (!useLB) branches.
Bug: T212129
Change-Id: Ib097082efb40b514a29a42286dc362f2e3743ee4
Using a bitfield breaks server array template merging in LBFactoryMulti.
The only nice thing about flags compared to boolean constructor
parameters is the existence of setFlag(), clearFlag() and
restoreFlags(). But that is not useful for parameters that are used
during connect.
Bug: T134809
Change-Id: I088ef4a0e4c11a2cfe17415b325b455164004c1e