Add BCP 47 codes to $wgDummyLanguageCodes to ensure that
Language::factory() will return a valid MediaWiki-internal code if
given a BCP 47 alias. We will want to make $wgDummyLanguageCodes a
private property of LanguageCode eventually, but let's start with
removing it from user configuration.
Setting $wgDummyLanguageCodes in LocalSettings.php has been deprecated
since 1.29. Hard deprecate adding entries to $wgDummyLanguageCodes so
that we can eventually remove manual overrides from user
configuration.
This is a follow-up to 48ab87d0a3,
which described the various categories of codes, and
21ead7a98d, which added the correct
BCP 47 mappings.
Bug: T207433
Change-Id: I9f6dda3360f79ab65f6392f44c98926588d851c8
Way back in r8196, a test was added to assert that Setup.php is being
included at file scope.[1] That test was broken when I633a6ff23 moved the
inclusion of DefaultSettings.php into Setup.php itself.
This fixes the test by having it directly set a variable and see if that
variable is a global. Yes, there's several ways to bypass it, but we're
just trying to avoid accidents here rather than trying to be foolproof.
[1]: Or really, in the same scope as DefaultSettings.php. But it
intended to be checking for file scope.
Change-Id: I9b5f15bf01c2903e8d44d85c54465d90c047cb51
The former is already a wrapper around ObjectCache::getInstance().
The latter was identical to ObjectCache::getLocalClusterInstance().
Bug: T115890
Change-Id: Ib4e43bc8d3f4ac9f7a453e36dcce9b3d962666ba
* Remove references to these old configuration variables
from documentation. Rather than wgLocalFileRepo referring to
these for more information, move the docs there, and point
there from the old variables.
* Move all their declarations in DefaultSettings.php together,
and be in the same order as used in Setup.php.
* Add missing @var type and @since version docs.
Bug: T25122
Change-Id: I4eb9490ed4e978b2c3954de0593a9d0d3c5fe73c
Previously, if an internal service forwarded the cookies for a
user (e.g. for permissions) but not the User-Agent header or not
the IP address (e.g. XFF), ChronologyProtector could timeout
waiting for a matching writeIndex to appear for the wrong key.
The cookie now tethers the client to the key that holds the
DB positions from their last state-changing request.
Bug: T194403
Bug: T190082
Change-Id: I84f2cbea82532d911cdfed14644008894498813a
This is controlled by a new config variable, $wgPageCreationLog,
which is set to false by default.
Bug: T12331
Change-Id: Ie3f6cc5ece0134433d5e4a572ea5eb0c3b700b8c
Since it takes time for the agent to get the response and set the
cookie and, as well, the time into a request that a LoadBalancer is
initialized varies by many seconds (cookies loaded from the start),
give the cookie a much lower TTL than the DB positions in the stash.
This avoids having to wait for a position with a given cpPosIndex
value, when the position already expired from the store, which is
a waste of time.
Also include the timestamp in "cpPosIndex" cookies to implement
logical expiration in case clients do not expire them correctly.
Bug: T194403
Bug: T190082
Change-Id: I97d8f108dec59c5ccead66432a097cda8ef4a178
* Remove left-over mention of the .php5 entry points in docs.
* Remove dead logic in NoLocalSettings for php5 entry points.
* Remove dead match in WebRequest for php5 entry points (they'd
redirect since 1.25, and not seen by PHP).
Change-Id: Ia0ee8588591860b8fe34030c8503f38e9bce31f3
Follows-up 26c2d03c17, 41d1fa1c3a and r11547 (c7f363f886).
Also add references to the relevant tasks about why the check
exists.
Bug: T189966
Change-Id: Ic1f0c79a1b5638bb30351a0cab55699931d1fded
$wgProfiler was introduced in 3ea576aa25 (r15605; 2006; MW 1.8).
The global was used from the Profiler.php class file, which
would be manually from StartProfiler.php, which then (if enabled)
assigned the global an actual instance of the Profiler class.
We needed it that way because we actually instantiated and used
the Profiler object (via wfProfileIn) very early on in WebStart.
Specifically, before any settings and classes load.
This first changed in 5a6d1ee2d3 (r86228; 2011; MW 1.17).
That commit deprecated use of $wgProfiler as an object in favour
of assigning it an array that MediaWiki would use to construct
the class. Profiling methods were also changed to lazy-instantiate
the class, which would first happen via a wfProfileIn() call two
lines before loading DefaultSettings and LocalSettings.
Some more relevant clean up happened in a0123d0549 (r89206; 2011).
Now, in 2018, we don't actually lazy-instantiate the Profiler
until after DefaultSetting and LocalSettings load. As such, I
think we can finally get rid of its out-of-bound load strategy.
Instead, we can simply set the default in DefaultSettings, and
recommend admins to set their value in LocalSettings.
Bug: T189966
Change-Id: I4e8dd9558132a5e38c22b26fed9c4b54cd324da7
* This is how it was before d5aa846d8, which accidentally changed
the behavior. The WAN cache call in Setup.php was too coupled to
the ChronologyProtector cookies. It made the assumption that DB
positions and cookies are stored even when there are no replica
databases setup (which changed in that patch).
* Check the "UseDC" cookie instead, which is already set in exactly
the cases this logic should apply.
Bug: T185328
Change-Id: I4dd2a6ca6cdead0052d59be86e6030dbe01f141b
This is step one in migration, 1.35 LTS should make it
[ 'html5', 'legacy' ].
Also issue deprecation warnings for $wgExperimentalHtmlIds.
Bug: T152540
Bug: T139744
Change-Id: I8780bb589002a4f836ba90bd18093a56cddc3ddf
This handles multi-DB transactions properly, instead of causing wait
timeouts in the WaitConditionLoop. It also is more correct in using
a counter instead of relying on wall clocks.
In addition:
* Refactor related code in MediaWiki.php to be comprehensible.
* Always send the cookie even the "remote wiki redirect" case.
* Renamed ChronologyProtector field and constant to avoid any
confusion of "wait for server X to reach Y" with "wait for Y
to show up in position store".
* Add an "asOfTime" field to the position keys for debugging.
Bug: T182322
Change-Id: I5c73cd07eaf664f02ba00c38fab9f49b609f4284
Clean up use of @codingStandardsIgnore
- @codingStandardsIgnoreFile -> phpcs:ignoreFile
- @codingStandardsIgnoreLine -> phpcs:ignore
- @codingStandardsIgnoreStart -> phpcs:disable
- @codingStandardsIgnoreEnd -> phpcs:enable
For phpcs:disable always the necessary sniffs are provided.
Some start/end pairs are changed to line ignore
Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
Also removed useless line from testLockTSE(). That would have needed
to be using $this->internalCache and those locks are freed immediately.
Bug: T180035
Change-Id: Ida1a923f779aaf8410da76643457d2200da6cb20
Setup.php was only injected the value from $_GET. LBFactory used
to check both before 0e5cd18b74, with the cookie check left
in LBFactoryMW. After d175b391ae, LBFactoryMW class switched to
the default LBFactory method for making a ChronologyProtector
instance, so the cookie check was lost there too.
This means that an HTTP GET request due to a redirect from a POST
request will still make sure the DB position store is up-to-date.
This only matters is that store uses replication (e.g. cross DC).
Also refactor LBFactory handling of the cpPosTime URL parameter.
Change-Id: Ie5744577609f4c193cacd71334f92b30f02e3846
Even if people use these (deprecated) functions in the earliest hooks or in
LocalSettings.php, it will keep working because GlobalFunctions is loaded
between DefaultSettings.php and LocalSettings.php.
The only places affected would be files in core: AutoLoader.php, Defines.php,
and DefaultSettings.php, which don't use these functions.
Change-Id: If4c0e8cbe1ea918283df22d72f792a3806569216
Follows-up 41ea7e2fef.
The following previously happened between PreConfigSetup and Setup
and must now happen either before it, after it, or moved inside it.
* WebStart: Detect missing composer.
This must be after Autoloader/Vendor but before the first call to
wfDebugLog (or other loggers) so that we can output a more descriptive
error instead of a generic "Unknown class" fatal error.
Moving it to before Setup is too early, and after is too late.
Move it to within Setup.php and make it work in CLI mode.
* WebStart: Install header callback
Moving it to before Setup is too early, and after is too late.
Move it to within Setup.php (no-op in CLI mode).
* WebStart/Maintenance: Load LocalSetings.
Must be between PreConfigSetup and Setup.
Move to Setup.php to maintain execution order.
Utilise MW_CONFIG_File for custom handling in Maintenance.php.
* WebStart: Initialise output buffering
Utilise (new) MW_SETUP_CALLBACK hook.
* WebStart: Display NoLocalSettings.php
Utilise MW_CONFIG_CALLBACK hook.
* Maintenance: Setting $wgLocalisationCacheConf, calling Maintenance::finalSetup.
Utilise (new) MW_SETUP_CALLBACK hook.
Change-Id: I633a6ff235b4275391c48034c0525d2fbfa3fecd
This is a first step of deprecation, next would be to swap the two
modes, making html5 fall back on html5-legacy. No separate release
notes are required as this is part of deprecation already documented.
Change-Id: I132cffbc70bf76f9863d61fd109c73da7bdaeb18
It adds the ability to replace the current section ID escaping
schema (.C0.DE) with a HTML5-compliant escaping schema that is
displayed as Unicode in many modern browsers.
See the linked bug for discussion of various options that were
considered before the implementation. A few remarks:
* Because Sanitizer::escapeId() is used in a bunch of places without
escaping, I'm deprecating it without altering its behavior.
* The bug described in comments for Parser::guessLegacySectionNameFromWikiText()
is still there in some Edge versions that display mojibake.
Bug: T152540
Change-Id: Id304010a0342efbb7ef2d56c5b8b244f2e4fb2c5
And auto-fix all errors.
The `<exclude-pattern>` stanzas are now included in the default ruleset
and don't need to be repeated.
Change-Id: I928af549dc88ac2c6cb82058f64c7c7f3111598a
ParserCache is already a singleton, making it a good candidate for a
service. $parserMemc is an odd global (it lacks the "wg" prefix) and is
ripe for deprecation.
The following are now deprecated:
* $parserMemc global
* ParserCache::singleton()
* wfGetParserCacheStorage()
A ParserCache::getCacheStorage() method was added for cases where direct
access to the underlying BagOStuff object is necessary.
Usage of $parserMemc will emit deprecation warnings through the
DeprecatedGlobal class mechanism. All usage in core was migrated.
Also take this opportunity to inject the $wgCacheEpoch global value into
ParserCache. This will require an update to the FlaggedRevs extension.
Change-Id: I2ac7afff0d8522214329248c3d1cdccd0f72bbd4
Defaults will be added to the config array at a later point,
without overriding any that have already been set.
This'll make it less prone to errors in case $wgGalleryOptions
is incomplete.
Bug: T168479
Change-Id: I5f127e5ac8c8a1583301dd7aed2ae8e434987950
While most of MediaWiki ignores the shell's/C library's locale setting,
there are some things other than shell execs that use it (e.g. the
luasandbox PHP extension).
To provide a consistent environment, set the locale in Setup.php instead
of letting it be changed mid-request depending on whether something else
happened to have called certain functions.
Bug: T107128
Change-Id: I02943803d26d5b1b3ac00ef9216f69cdfa149585
$wgDummyLanguageCodes is a set and mapping of different language codes:
* Renamed language codes: ['als' => 'gsw', 'bat-smg' => 'sgs',
'be-xold' => 'be-tarask', 'fiu-vro' => 'vro',
'roa-rup' => 'rup', 'zh-classical' => 'lzh',
'zh-min-nan' => 'nan', 'zh-yue' => 'yue'].
The old language codes are deprecated because they are invalid but
should be supported for compatibility reasons for a while.
* Language codes of macro languages, which get mapped to the main
language: ['bh' => 'bho', 'no' => 'nb'].
* Language variants which get mapped to main language:
['simple' => 'en'].
* Internal language codes of the private-use-area which get mapped to
itself: ['qqq' => 'qqq', 'qqx' => 'qqx']
This is a very strange conglomeration which should get differentiated,
and were split up in the following ways:
* Renamed language codes are available from
LanguageCode::getDeprecatedCodeMapping().
* Language codes of macro languages and the variants that are mapped to
the main language are available as $wgExtraLanguageCodes and are set
in DefaultSettings.php.
* Internal language codes are set in $wgDummyLanguageCodes in Setup.php.
Change-Id: If73c74ee87d8235381449cab7dcd9f46b0f23590
Install the backtrace collector very early, so that we can get the
backtrace even if headers were sent from LocalSettings.php.
Bug: T157392
Change-Id: I9bc732b34481c95afb5362e135a87bd4302498e2
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.
Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
There is no point in local thumb caching when we set apibase
and thumbUrl to the remote wiki. It will only confuse MediaWiki
into creating local thumbnails for certain LinksUpdate tasks
even though the rendered page will reference thumbnails hosted
on Commons.
Bug: T145496
Change-Id: I0bd4b539f575036dd865bdd946660f10a9ee8801