While writing an upgrade patch for Femiwiki I noticed 2 bugs in
the existing code. I've added test cases for them both and added
fixes.
Bugs were:
* Skin::makeLink renders empty span when no text
* link-html is not copied to personal menu items
Bug: T305270
Change-Id: I70f1bcff57761bd7af50dbe74e5bfdaa3ae2d6a5
Added support for an easy to configure multi-tenant ("wiki farm") mode:
Settings for each site can be placed in a directory specified by
$wgWikiFarmSettingsDirectory. Site detection is controlled by
$wgWikiFarmSiteDetector and defaults to the requested host name.
Instructions for manual testing: https://etherpad.wikimedia.org/p/T221535
Bug: T221535
Change-Id: I7581921b7d99ba1fe7e25523fde691d76b67a99c
Follows-up Ief9e724c84755248, which increased this
from 5 to 1000 API requests.
Bug: T298735
Bug: T225730
Change-Id: I567712f167a7264c22dd86f6005e5fa60939c752
If the on-wiki "mainpage" message is a bare local interwiki
(`localiw:`), MediaWiki will try to normalize it to the main page,
causing an infinite recursive loop. Once in this state, there's no way
to fix it short of editing the database (or applying this patch).
The easiest way out of this is to add a recursion guard to fall back to
the hardcoded "Main Page" default.
Bug: T297571
Change-Id: I91316ecbdbe7c4ad1b7594643aef29a8e1f8fb26
The initial object comparison using `==` compares all the property values
using `==` as well. This causes (for example) the string "1" to compare
as equal to the number `1`, the empty string `""` to compare as equal
to the number `0` and other surprising things.
It appears that this comparison was done at an attempt at performance
optimization, but that has little place in a test suite. Use the full
recursive strict comparison instead.
This requires updating one ParserCache test case which was apparently
created incorrectly (or not properly updated) and relied on the
previous behavior (numbers comparing as equal to strings) to pass.
Change-Id: Ife0e9ccc7be0f4933975bb326203693bc15a9658
Changes:
* Internal SkinTemplate::getSearchInputAttributes method is removed
* Skin::makeSearchInput and Skin::makeSearchButton are hard deprecated.
Methods moved to SkinTemplate to support skins using BaseTemplate
(this avoids deprecation warnings in Timeless)
* Correct the function signature for Skin::getRelevantTitle and the
caller in Linker to take into account the use of getTitle and the
possibility of a null return.
Bug: T301723
Change-Id: I0906cd1582b93c741b93503562ec0fe37d80d948
* Adds option to undelete associated talk page in the context of a
subject page
* If subject page undeletion fails, talk page undeletion is aborted
* If restoring the associated talk page fails, a status with a
warning message is returned
Bug: T304962
Change-Id: I7b30863060974d4079639f57178062d359956c2e
This reverts commit c9c6bab379.
Reason for revert: This broke VisualEditor editing.
Not sure why but will repost in different format.
(https://phabricator.wikimedia.org/F35030276)
Change-Id: I7f21a2c756d06f488766896086e5b3488a366c19
The real option manager would do such fallback, this behavior should
be kept in tests.
(Depends-On I814050cfa86ec1e86291d380843eb319fddc924a)
Bug: T297082
Change-Id: I55f7d1e17bde904f2245b31df2df853cf0ca803f
According to the function signature of WatchedItemStoreInterface
a PageIdentity must provided. Any other parameter is deprecated.
The test is updated as it's trying to watch a special page and it's
not possible to watch special pages.
Change-Id: Ia97e497fbae922e46a1098bca32ad3d8d62070fa
Logo variant override is available for 'wordmark' and 'tagline' in
the new Vector skin and has been used for a while, but the 'logo'
feature built in the core didn't take variants into account.
The logic should be pushed down to ResourceLoaderSkinModule so that
behavior can be consistent between skins and core.
Also, old code use $title->getPageViewLanguage() to determine the
variant of logo, which is a wrong behavior. Logos should be in the
interface language instead of the content variant.
Bug: T273578
Change-Id: Ifb3cc45600d57cf9c72757016148684cd7ab1400
This matches the behavior of PHP Title (added tests to confirm),
and supports a common case of obtaining the title text using the `URL`
API, when the 'title' parameter is using a legacy 8-bit encoding.
Change-Id: I04464c17369ffb0dd4e7c33d2bd4db7b2d050bf4
This method is dependent on, and inherently must depend on, all of
Title, WikiPage, and WebRequest. And, like Title and WikiPage,
which also have getters in RequestContext, Action is also derived
from a query parameter that is widely recognised in almost all
web requests to index.php.
The status quo in core and extensions, is to obtain this value
via Action::getActionName(), which as a static method that bypasses
dependency injection and also has the problem of not being cached.
Caching it within ActionFactory seems hard and awkward, due to
varying by context.
In change I61d66211bd (22f9a32853) a cached wrapper method was added
internally to the Skin class. In change I8cbc4bba4d248d9 (235820d631)
another cached wrapper was added in the Gadgets extension.
This change takes this approach further by making it a stable public
method on RequestContext.
To facilitate testing and to offer basic confidence in this working
correctly, this commit also adopts the new method in two place that
are considered "safe" (Skin, and OutputPage). Both of these are
called relatively late in the PHP proccess and well after any Setup
code and overrides (such as in MediaWiki.php), during which it is
more complex to call this. I'll audit and update those in a subsequent
change.
Change-Id: I1e259b54dca48a32be5a8c6cbb8eb69aec2da115
Registering fewer modules reduces the size of the startup module.
The current skin is read from the skin parameter to the load.php
request. Modules can opt-in by specifying skins in which they are
relevant, by overriding getSkins() of ResourceLoaderModule.
Bug: T253582
Bug: T236603
Change-Id: I08a1a59b4eab90d380ca8f874bb6dbba2f399590
Conventionally, public constants are accessed via their declaring
class, except for self:: which is an acceptable shortcut.
Change-Id: If05eab72140267e6ef54736710d751d7f24a7860
This patch introduces a new system message,
MediaWiki:copyupload-allowed-domains, which lets sysops to define which
domains can be used with the upload-by-url tool. This feature is behind
an off-by-default feature flag, which lets system administrators
disable this feature if it is not wanted.
Bug: T300407
Change-Id: Iae7dafbd71182695444210409d550e5b6d10928b
Pass the error number as an argument, similar to isConnectionError()
Fix related mysql documentation links
Change-Id: Id32ef2fd27de65376960de3f5138ffdf7654ff71
The 'contentformat' param should only have effects when the parsing
is based on the 'text' param, as what the document described.
Bug: T206253
Change-Id: Ia12b8697e515c6ba89ea81f085292d1ef018bf58
Format like 'application/json' is not supported for content model
wikitext, don't fail as internal exception.
This fix the case when providing text/title parameter.
Bug: T206253
Change-Id: I20ef52aa961143b7c50283c0d06acea9f220619c
We changed to operate on an int internally in I92daeb0f7be8a0.
Let's cast it back to a string for the api in order to prevent
a breaking change, which is not really necessary.
Bug: T304171
Change-Id: I5f5a9203b4dd085cb5defba72c6650532bc9e8d1
Deferring newtalk updates caused the skin to show the notification on
the same user talk page view request in which it is cleared. Even if the
user refreshed the page, it would still show the notification since a
304 response was given.
So, move the newtalk part of WatchlistManager
::clearTitleUserNotifications down to TalkPageNotificationManager, so
that the in-process updates can be done immediately, with the DB updates
being deferred. TalkPageNotificationManager is now responsible for
deferring the relevant parts.
Originally (2002) the newtalk status was set by calling
User::saveSettings(), which had the side-effect of updating
user_touched. Restore this behaviour, which is fast now due to the
"quick touched" cache. Also update the touched timestamp when the
notification is cleared.
Change-Id: Ic3c14bca7bed04f46afffa971fa0a57224c666ce
This reverts commit eed58f2f61.
Reason for revert: Blocking the train, going to revert the whole chain
Change-Id: I64f9e5a9dde106671783f958a686ca697182077b
LinksUpdate is a group of deferrable updates, not jobs till now.
See HtmlCacheUpdater::purgeTitleUrls().
Bug: T165099
Change-Id: Icf40c4ff9e14ee06d48600bcbfdc39e2baf68b23