Mostly, use strict comparisons, and use Html:: methods instead of
building strings manually when convenient. Also add typehints to private
methods and replace a couple of deprecated things.
Also ensure that $this->section is always a string (like the
documentation claims) by setting a default in importFormData.
Change-Id: Id7c8817e55b5deb85788b1d3491f9be4d2a95874
* Add BagOStuffTest subclasses for all core BagOStuff subclasses,
replacing PHPUNIT_USE_BAGOSTUFF, as suggested in a todo comment.
* Add config $wgEnableRemoteBagOStuffTests which causes all tests
enabled by $wgObjectCache to execute, which means that the memcached
tests are executed by default.
I have verified all except RESTBagOStuff and WinCacheBagOStuff. The
memcached tests fail against memcached 1.5.x but pass against memcached
1.6.x.
Bug: T90875
Change-Id: Id74b5226669f8cb857f859fbc35bc58ab001e873
It turns out this gets rid of a bunch of suppressed
"SecurityCheck-DoubleEscaped" that appear to have been accurate
warnings.
There seems to have been some confusion about how ::truncateForVisual()
is supposed to be used; in particular it is to be passed *unescaped*
output, because it is not (generally speaking) safe to truncate
HTML-escaped strings. The goal of ::truncateForVisual() is to have
a specific number of codepoints in the output for display purposes,
the encoding of those codepoints is not an issue (htmlspecialchars
can be applied to the *return value*.) If you need a specific number
of *bytes* you should be using ::truncateForDatabase(). If you want
a certain number of *HTML bytes* then the ::truncateHtml() method
is probably what you want.
Slightly refactor some code in RevDelLogItem to avoid a false positive.
Bug: T301205
Bug: T290624
Change-Id: I893362e049aedfa699043fcf27caf4815196f748
Calling the service locator in code used in the service wiring is
asking for trouble.
I found this using some arcane hack that calls applyDefaultConfig
in its own, pre-setup, service locator.
A perfectly good ServiceOptions is available, with much less
indirection. Makes the thing more testable too.
Follow-up to I1a691f01cd82e60bf41207d32501edb4b9835e37.
Change-Id: I38d4db2b7d897ebbceac8e773bb0512a8fc484d3
T301346 was caused by a SpecialPage being passed
from this function down the chain to WikiPageFactory::newFromTitle
which only accepts a ProperPageIdentity.
Document that this function will @throw even though its
param is only typed to accept PageIdentity.
Bug: T301346
Change-Id: Ie61abd74d1be6942d98efa16f8f440e25dc6db88
In preparation for refactoring SkinTemplate so that SkinMustache
extends Skin rather than SkinTemplate, we take the opportunity
to reorganize the skin code around the concept of components.
Going forward a skin will consist of multiple components, each
of which must return template data that can be passed to an
associated template.
This will result in code that is easier to work with, compared
with the existing 3000 line skin class.
This is the beginning of that journey. Other components will follow
while maintaining backwards compatibility
Bug: T263213
Change-Id: Ib62724c24601e04aa13ab09b3242e70d7d6436ca
This is adding a lot of PC entries for pages that possibly won't ever
be visited. This is similar to what Refreshlinks job does and doesn't
save at all.
Bug: T285993
Change-Id: I68c14932d568795ab54074e073eab2a80517ed70
Change the metric names such that they do not overlap between
logically unrelated categories.
One non-overlapping metric for outcomes.
One misc metric for warnings and other unusual observations which
may overlap with outcomes.
Within outcomes, don't require metric queries to the names and/or
manually group them as positive or negative. Use a prefix to
distinguish between early exists that are bad (logged as failure and
will retry), and those that are considered good (no problem,
job superseded, no retry needed).
Bug: T301432
Change-Id: I2d5f3cc7cc2229cd910f341cf1f51d1e26be6e58
When a nonexistent message is requested, a WAN cache request results,
because nonexistent keys are suppressed in the main cache by
isMainCacheable(). There is some performance degradation when such
keys are requested on every page view.
So:
* Make it so that keys prefixed with accesskey-, tooltip- and nstab-
use Message::isDisabled() instead of Message::exists(), so that they
can be blank instead of missing by default.
* Add blank messages for several such keys.
Change-Id: Ie70d849a8ecbf9ab70e58f582b9ba89afe9f2829
The "error" class nowadays is only supposed to be used by Parser and
related code. It renders as red text with no special formatting.
Instead use Html::warningBox(), which renders a yellow box around the
text. (Not Html::errorBox(), because these are not really errors.)
Change-Id: I7a7046bf9b9765cbb82ec3caa1530de7f05e0da4
This just helps distinguish ParserOutput and OutputPage in code search,
since they have many identically-named methods.
(See Ie4d6bbe258cc483d5693f7a27dbccb60d8f37e2c for instance.)
Change-Id: I786381c98c6d7e1f5e9d7333d6f53a282985fbbc
If a RefreshLinksJob is created with an improper/invalid title,
executing the job later will fail with a PageAssertionException
while trying to create a WikiPage for that title. Better check
the title when constructing the job, so the offending code is on the
stack when it happens.
Bug: T293291
Depends-On: I7dcfac0eacdd5b22bdf443e88f8e6ddb883b92cc
Change-Id: I77a622591836873415f097453da01ca7e61c41be
Title::newFromText with empty string will always yields null.
But the decision to return null is only made after applying
various normalization and filtering routines, which will
eventually have zero effect on the return value. So we may
just return the null early as we do with null itself.
Change-Id: Ic277a6e8c8c0b2a0b6af78f6524b80574c4602af
Just added the low-hanging fruit: the methods where the return type was
obvious from local inspection.
Change-Id: If6aabfc8f0dacb156167745808fd5c57cdb3eb23
This is a first draft of the configuration doc renderer.
The resulting markdown certainly needs some love, but
we can work on improvements incrementally. This gives
us a baseline to reference on doc.wikimedia.org
Bug: T296647
Change-Id: I3c426b9fc37b1cf7ce8423969b2d7589767ee6cc
LightnCandy resolves recursively-defined partials twice, which leads to
the template file being hashed twice. While the cost of hashing the
partial the second time is minimised due to
FileContentsHasher::getFileContentsHash() caching the hash of a file in
APCu, it need not be paid.
Bug: T300210
Change-Id: Id3f62bf32c47f21181b1ec6d77a5ae9a703952b1
Forced-on options (selected as default but disabled) should always in
the loaded data, like what HTMLCheckMatrix do.
Change-Id: I342928eca01ae8a9f34ee7156a515524c3a0d9dd