There is a fallback in Module->getConfig() to the global services
container. This is not meant to be used in practice, but there were
two places where this was missing: WebInstallerOutput, and various
PHPUnit tests.
* Add missing setConfig() to WebInstallerOutput.
* Add missing setConfig() to various tests. Most tests were already
doing this correctly and using the standard mock from
ResourceLoaderTestCase. Upon switching the last few tests as well,
I uncovered various errors due to the mock missing some settings
that the tested code uses, so these have been added now to
ResourceLoaderTestCase.
Bug: T277728
Change-Id: I44f16ec4e00423fb6f641e58fffc1d40e4571f01
The installer needs a handful of the styles provided by
ResourceLoaderSkinModule. Reduce it to the minimum required in
preparation for the deprecation of the `legacy` feature.
Bug: T232903
Change-Id: I6a718232897448a94fe1ddda547ae5a5c671b7aa
The `mediawiki.skinning.interface` module includes the `toc` feature
which is enabled by default,
which requires a working localization environment which requires
DBLoadBalancer which is disabled at this entry point.
Instead use ResourceLoaderSkinModule directly with an opt-in
policy where toc feature is not disbled.
This means the definition in Resources.php is no longer
necessary so it is marked for deprecation. The installer
now works.
A unit test is added to make sure the installer stylesheet
doesn't break again.
Bug: T270027
Change-Id: I851fcd0e50e3a70158d5bfa1fdcae3cd278694d6
Rather than hardcode a Vector module, the installer should use the fallback
skin.
This leaves it mostly unstyled, which will be restored in a separate change
that adds a minimal stylesheet for the web installer (see Ibdb0a7208).
Bug: T248133
Change-Id: I5c7f16ec9efda35b94355b6c81ec78d9bdfb574b
Instead of exporting this as a global variable, export it as an extension
attribute.
The $wgResourceModules configuration variable will continue to be supported
for its main purpose of adding modules. However it may no longer be used to
access the complete registry. In actuality, it was already incomplete because
modules defined via 'ResourceLoaderRegisterModules' hooks were already absent.
The full copy is now owned only by the ResourceLoader class and publicly
available via isModuleRegistered() and getModuleNames().
This opens the door to making it a lazy-loaded attribute, which would help
reduce the size of the "main" APCu cache key for ExtensionRegistry.
This is not possible with global variables as those must be exported
unconditionally from Setup.php.
Bug: T32956
Bug: T247265
Change-Id: I13cf05af458131ce8439eee770d7a62bd9404288
Skins that are using ResourceLoaderSkinModule will need to update their
features to include `legacy`
Note that Ic7af947cfd5a5df4218f006232ede4ee7ed36c62 for Vector
and I6471bc169f3c2a1f51e17b8ee26ac245b0374c18 for Monobook should
be merged in the same release as this patch to ensure these styles
do not disappear from those skins. Minerva or Timeless will not be impacted.
Changes for other skins including Modern and CologneBlue to follow
where needed.
Bug: T242177
Change-Id: Icb910a563273bde92a09b1bb92857d5b6e348baa
ResourceLoaderFileModule::readStyleFile() both reads a style file from
disk and processes it through LESS, CSSJanus and CSSMin. Factor out the
processing part into ResourceLoaderFileModule::processStyle(), which
takes a string of unprocessed CSS/LESS rather than a file. This is
needed for future support for styles that don't come (directly) from a
file, but are generated through packageFiles.
Other changes:
- Use a hash of the source instead of the file name in the cache keys
for the LESS compilation output
- Also prefix the cache key with 'resourceloader' while we're changing
it anyway
- LESS compilation no longer adds the source file itself as a dependency
- Don't pass down $flip, just use $this>getFlip()
Change-Id: I86e880d06af724f0fbae93e042c85e0395771912
Also improve the description a bit and explain at a high level
how this code is used, and which classes back those entry points.
Change-Id: Ia69531858e714d0b43a29a7d5b6dcc5c7edd8240
It also removes some code duplication which is nice.
This unlocks various future changes, including:
* Making the `$config` parameter mandatory for the ResourceLoader class
constructor, which currently falls back to global state.
This should be deprecated and removed.
* Making it possible to instantiate the ResourceLoader class
without all the default MW modules being registered from
global state. E.g. move MW module registration from main class
constructor to ServiceWiring, and remove the 'EmptyResourceLoader'
class hack from unit tests, and use regular 'new ResourceLoader'
instead.
* Making ResourceLoader a standalone library (some day),
e.g. allowing it to be instantiated from a basic PHP script,
in a way that is still useful and perhaps able to serve
(most) RL modules without MW itself.
Bug: T32956
Change-Id: I4939f296c705b268e9cf8de635e923a739410470
Combine the functions getLanguageCode() and getDir() to the single
function getLanguage().
Also mark the class WebInstallerOutput as @private.
Change-Id: Ic7deea5f3040fe8f1211b96622bdae222ca9e072
This change changes the CSS URL in the stylesheet link from
<link rel="stylesheet" href="/mediawiki/mw-config/index.php?css=1"/>
to
<link rel="stylesheet" href="/mediawiki/mw-config/?css=1"/>
on the website /mediawiki/mw-config/.
Change-Id: Ib46c4d944df862cf928d3ebd050ff2d1e16ba6a5
Follow up to I89f3398cffa771afcd5a33cfd11eb8510af3e7f7: this patch
was intended to mirror a new method added to OutputPage in
Ia58910164baaca608cea3b24333b7d13ed773339 but the bikeshed was painted
a slightly different color before the OutputPage patch was merged, and
somehow this patch wasn't changed to match. The `addWikiTextInterface`
name was never included in a released MW version, so we don't need to
deprecate it, just fix it.
Change-Id: I636cb0ea0f9631c4c5e2bc118f479aec76d2b231
This change parallels the new method added to OutputPage in
Ia58910164baaca608cea3b24333b7d13ed773339 and ensures that the
content added is always tidied. We leave the old alias in
place for now in accordance with our deprecation policy.
Change-Id: I89f3398cffa771afcd5a33cfd11eb8510af3e7f7
This advances T140664 as well, because it encourages module
loading logic from the skin to be in this single method.
Update the tests for setupSkinUserCss(), to now target
getDefaultModules() instead, given setupSkinUserCss() no longer
provides these behaviours. Had to move where the mock object
was created so that it can be injected in the skin (previously
it could be passed as parameter). Besides, its generally best-
practice to create mocks and stubs within the test anyhow, not in
the data provider.
Bug: T140664
Depends-On: Ib2b19ba165a9d646a770702cdf1724509156b93e
Change-Id: I3404c1c2a7e8eae0b803b31f333cb9b837f43d4a
I was bored. What? Don't look at me that way.
I mostly targetted mixed tabs and spaces, but others were not spared.
Note that some of the whitespace changes are inside HTML output,
extended regexps or SQL snippets.
Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
Follows-up a464d1d41 which changed OutputPage::headElement()
to join pieces by a line break instead of hardcoding line breaks
after (some) generated pieces.
This caused a minor regression in the form of a blank line between
<html> and <head> on every page, because I missed the one that
came from this class.
Change-Id: I5e48b852809699b205f4581c833605f3e232610a
This fixes three issues with the installer:
1) Make sure LocalizationCache can find the installer's i18n files.
2) Make sure we don't try to use an SqlBagOStuff for caching before we have
a functioning database.
3) Don't try to output HTML when redirecting (this is unrelated to
MediaWikiServices, but came up during testing)
Bug: T135169
Change-Id: I7caa932024cd771d6fa226a3ac6001c3148ecc9c
* Remove ResourceLoaderFileModule::getLessCompiler(). There is no reason for a
module to need to get a compiler in a different manner than
ResourceLoader::getLessCompiler().
* Add ResourceLoaderModule::getLessVars(). This method provides a means for
subclasses to easily inject custom LESS variables. The default implementation
simply returns an empty array.
* Make the $context parameter for ResourceLoaderFileModule::readStyleFiles()
non-optional (via graceful deprecation). The only callers I found were either
already calling it with a ResourceLoader context, or had a perfectly usable
ResourceLoaderContext in local scope.
* Make ResourceLoaderFileModule::{readStyleFile,getLessCompiler} require a
context. These methods are protected, so I didn't bother with a deprecation.
* Call ksort() on the LESS variables array in the only place it matters -- when
hashing its serialized representation to construct a cache lookup key. This
relieves getLessVars() subclasses from having to remember to re-sort the
variables array if they modify it.
* These changes make it possible to substantially simplify
ResourceLoaderEditToolbarModule, because the only thing it needs to do now is
implement its own getLessVars() method.
* This also allows it to be versioned like any other ResourceLoaderFileModule,
rather than having to use enableModuleContentVersion().
Change-Id: Ic3eab71691e502bfe19bdf4eb6f82cc679a7782f
Vector now has a skin.json and the PHP entry point is just a stub, so
including it doesn't do anything. We can read from the skin.json file
and register the module properly instead of depending upon implicit
globals.
Also make ExtensionRegistry::__construct() not fail if $wgObjectCaches
is not set up properly, which is the case sometimes in the installer.
Bug: T98043
Change-Id: I5a653b095665092f8a27416b8a7f28ebf7d4d8c1
- Added/removed spaces around parenthesis
- Added newline in empty blocks
- Added space after switch/foreach/function
- Use tabs at begin of line
- Add newline at end of file
Change-Id: I244cdb2c333489e1020931bf4ac5266a87439f0d
MediaWiki installer works fine in a bareskin
mode without Vector features, so do not
throw errors in the PHP error log just because
we don't have "skins" project extracted.
The message in the PHP error log:
Warning: include_once(w/skins/Vector/Vector.php): failed to open stream: No such file or directory in w/includes/installer/WebInstallerOutput.php on line 135
Stack trace:
1. {main}() w/mw-config/index.php:0
2. wfInstallerMain() w/mw-config/index.php:38
3. WebInstaller->execute() w/mw-config/index.php:79
4. WebInstaller->outputCss() w/includes/installer/WebInstaller.php:185
5. WebInstallerOutput->getCSS() w/includes/installer/WebInstaller.php:1200
Change-Id: I7b8bd77f5868af2ccf464e48db771f2e8e0472ff
The WebInstaller don't use classes, so it broke after Vector skin changed
to use classes instead of ID's
See: Iae873906abcd8b2a986e5f728f0ce207256de770
Bug: 70190
Change-Id: Ia70498a0ee7c99d000790223c44feddce73a5416
The CSS and JS files are definitely used only by the installer.
As for the images:
* mediawiki.png is still used directly by some error pages
(includes/PHPVersionError.php, includes/templates/NoLocalSettings.php)
* ajax-loader.gif is still used by shared.css
* bullet.gif is mysteriously used by *something*, according to the
logs at bug 69277 comment 11; I currently have no idea what, so
let's keep it here for a while
* All other ones don't grep (outside of the installer itself) and
don't appear in the logs on bug 69277.
Bug: 69277
Change-Id: I9146d9211a807911a5e0cfaa1dd3ab8170f333ca
This makes it behave exactly like a custom skin, with the caveat that
it is still hardcoded in several places :(, most notably lots of
skinStyles in Resources.php, the installer and some tests.
* Renamed directory to reflect skin name.
* Split skin classes to separate PHP files.
* Removed core autoloader entries for skin classes.
* Changed the hack in Setup.php to require_once the skin PHP file, as
the skin is now registered there.
* Extracted skin-specific localisation messages.
* Extracted skin-specific resources. Did not touch skinStyles yet.
* Hacked up the installer not to fall over entirely if Vector is
missing.
* Adjusted hardcoded paths in some more places...
Change-Id: Idfffc1430790b3a104cc9835a6367137bcbf0e4e
Also:
* Fix incorrect documentation comment of ResourceLoaderModule::getStyles(),
it doesn't return a string, it never has.
* Remove spurious space in count() call.
* Fix spelling of in "proper".
Change-Id: I000393636f7b9015ad1bacfbb3eb8a6ad8695d72
Instead of passing around the direction in the request, just set
'css=1'. We already have the language code and directionality
available and even rely on it between requests to set other
localisation-related things.
Change-Id: I717cb299b3639024e79880039e0d1f2ff273ab44
For consistency in module naming: skins.* contains the modules for
particular skins, mediawiki.* contains the modules for core MediaWiki
itself. Clearly this belongs more to the latter than the former.
'skinning' is probably the best thing to name these to not sound silly
and avoid confusion with actual skins.
(The fact that there are files in skins/ that are not skin-related is
a remnant of bad decisions in the past. I want to clean that up as
well this year.)
Updated release notes and usages, kept old definitions for HTML
backwards-compatibility (for 30 days on WMF deployment).
I intend to backport this to 1.23 (sans the compatibility modules).
Otherwise the current module names become "public API" and we either
break compatibility later or support them forever.
Change-Id: I3947eaacd389eaba32f6fc8370395caec4aa1edb
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.
Change-Id: I3595e9aac69ac42fbb74b0783fae0ad9bcc831aa
This is a follow-up to Ide17d5af13c416c62a40029848ac17ba24eb5563.
However, I could not fix the "minor style" issue mentioned there
because this would make the line to long.
I fixed lots and lots of other issues instead, e.g.:
* "void" isn't a thing. Added "return null" instead.
* Removed documentation that said "a constructor is a constructor".
* Use "string[]" and such instead of "array" if possible.
Change-Id: I9658c2af58862f1d634cf1b2ba4c9d0f27ee7608