When originally introduced, a skin's templateDirectory was relative
to core, rather than the skin itself. Most skins needed to set
something like "skins/Example/templates", hardcoding the default value
of $wgStyleDirectory.
skin.json will now assume that the value of templateDirectory is
relative to the skin itself. If that directory doesn't exist, we'll
fallback and assume it's using the previous behavior of being relative
to core. In practice this should not be a breaking change since no skin
is expected to have a directory like "skins/Example/templates" inside
the skin itself.
Finally, ExtensionProcessor will set a default templateDirectory if
one isn't already set, so in most cases this setting should be able
to just be removed entirely.
Bug: T262067
Change-Id: I434b8a4319f3c8b65bcaab3465224058f31e7ae8
Most of the time this is due to garbage user input, and MediaWiki's
normal handling of user input strings is to normalize them, not to
throw.
There are some hypothetical cases where a developer might want to see an
exception, rather than passing garbage to the client and letting the
client fail, but normalization is a defensible policy and works within
the existing interfaces.
Bug: T289597
Change-Id: Ida5ee72c10d1c3499b5b17594c5675db7cd38335
Methods are promoted upwards from SkinMustache to SkinTemplate
in preparation for them being shared between SkinMustache and
BaseTemplate.
This is mostly a move of existing functions in SkinMustache but
also introduces SkinTemplate::getTemplateData and updates SkinMustache
to call the parent function.
Bug: T263213
Change-Id: I028364eb91e907c2f51529aac495df1eaca7b466
Use ContentTransformer::preSaveTransform instead.
Extensions defining a content model should override ContentHandler::preSaveTransform.
Bug: T287156
Change-Id: I2a8c60470366fd95d056e0dfa8144f209bb7117e
Use ContentTransformer::preloadTransform instead.
Extensions defining a content model should override ContentHandler::preloadTransform.
Bug: T287157
Change-Id: I766d793881812524fb9762292b7abedeb3cd0769
Disallow changing unique key values of rows in the upsert() assignment.
The unique key values are used to decide which new and old rows collide.
Changing these values at the same time is too complex and ill-defined.
Disallow setting NULL values for columns of the identity key in upsert()
and replace(), unless they are all NULL for all of the rows. This edge
case can be treated as a plain INSERT, assuming that conflicts are not
triggered over weird DEFAULT column values.
Update the corresponding IDatabase documentation.
Change-Id: If6e0cecce32a5eedaf9a82b67ba41296bfa4a317
About 1.5% of load.php wall-time is spent in isFileModule() calls
during the ServiceWiring/getResourceLoader/register call early on.
Reduce the overhead of this cost by moving that logic to the Module
class.
There are two costs that we save this way:
1. The inherent cost of applying the skinStyles.
This is now limited to only the modules that are constructed in a
given web request. Thus, apart from the startup response (which
constructs all modules), for regular load.php requests and all
index.php page views, the vast majority of modules will never need
to be constructed, and thus won't pay this cost.
2. The overhead of predicting (and class-loading) for whether a module
is (or will become) a FileModule object.
This is what isFileModule() does and is the main reason I wrote
this patch. It involves class loading, and checks and conditions that
run 1000+ times at WMF. This is eliminated now because we no longer
have to calculate this decision. Instead, the logic applies when
it needs to (due to FileModule implementing it), and doesn't
when it doesn't!
Change-Id: Ia2db14f930800c96e767b94ef62fb00e9d52725b
This was covered in small ways already, but we did not have coverage
of the registration logic where the skin attribute is injected into
the module info, and this then correctly getting read and composed
into a single stylesheet.
This is prep for an optimisation in a subsequent commit.
Change-Id: Ia6fff44a345bb4f5811956638cada8b3e6b6ea71
In commit 70c2223843, the explicit type checks were added as
exceptions because WMF's infra at the time didn't capture stacktraces
for the native warnings that PHP already emits.
That infra issue was resolved years ago (T45086), so we can remove
these again.
I've kept one manual type check, which is in setField, because for
$field in that method we don't first check existence (which emits
the warning normally), and because it does an assignment rather than
a key check, and assignments in PHP still have some invalid types
that don't emit warnings (specifically, booleans).
Bug: T275673
Change-Id: I72388f069afc345da9e9aac330733da49714d1b4
Update ContentTransformer to access ContentHandler::preLoadTransform through the service.
Prepare object to hold a data that required for ContentHandler::preLoadTranform params.
This is a fully backwards compatible change.
We are doing hard deprecation via MWDebug::detectDeprecatedOverride.
However, with the ContentHandler calling Content and
Content calling ContentHandler, it doesn't matter whether
callers use Content or ContentHandler. This will allow us
to naturally convert all callers.
Bug: T287157
Change-Id: I89537e1e7d24c6e15252b2b51890a0bd81ea3e6b
This version fixes a flipping bug.
Bug: T288943
Depends-On: Ida34372a4e5acb3147d83c7a1d008850c8382e32
Change-Id: I0528443e4eae0338f5a37491352db03944c6bd4c
The comment added in b9461e3f1c is incorrect. This is actually a
decode error, so is relevant to FormatJson::parse().
Change-Id: I3cc33f0f260c0ba4fe96fb75565f52d089b9a975
With mocking HTTP, we can supply an array of requests
to expect, but if MultiHttpClient or Guzzle client are
used, we can only supply one. Now we can mock a sequence
of requests done via either of these clients.
Change-Id: I350ed59af603a0504704af3265787a4be8f2dc2a
Empty leading components should still be colon separated. Although the
keyspace and collection should never be empty strings, it does not hurt
to handle that case anyway for safety.
Change-Id: Ic89acaf1fe5c34e58323b2913a9a26f973868590