On 20/05/14 22:07, Daniel Friesen wrote:
On 2014-05-20, 2:25 PM, Bartosz DziewoĆski wrote:
There seem to be three popular ways:
- $IP/skins/SkinName.php for the main file plus $IP/skins/skinname/
for assets, using an autodiscovery mechanism to automagically make the skin available after the files are copied in the right place. This is used by all of the core skins (Vector has some special cases, but let's ignore that for now), as well as many external skins (e.g. Cavendish [2]), at a glance mostly older ones.
I wouldn't say it's popular. It's just the way it was done in core and the only way anyone without knowledge of large swaths of MediaWiki could figure out.
- $IP/skins/SkinName/ for both assets and PHP files
($IP/skins/skinname/SkinName.php etc.), using require_once in LocalSettings like extensions to load the skin, manually adding an entry to $wgValidSkinNames in the main PHP file. This seems to be the preferred method among "modern" skins, for example Erudite [3] or Nimbus [4].
You're misstating this pattern, the pattern goes:
- $IP/skins/skinname/skinname.php
- $IP/skins/skinname/* (assets)
The directory name and entry file are both lowercase, not skins/SkinName/ nor skins/skinname/SkinName, this means:
- The skinname you require is the same one assigned to $wgValidSkins and set on $wgDefaultSkin and set on $skinname, and $stylepath.
- For all skins using the old autoload pattern the assets directory remains them same, so nothing has to be re-cached.
- The same "entry filename = dirname + .php" pattern we've worked to make extensions follow is followed by skins, which will also help implement special loading for skins.
This is the pattern described by the tutorial I wrote, used by Erudite, monaco-port, every custom skin I've developed for a client, and the pattern that should be used going forward. I had hoped to eventually add special behaviors in the loading of skins that would reduce the boilerplate needed to setup skins following this pattern.
- $IP/extensions/SkinName/ for everything, the rest as above. This
makes the skin work exactly like an extension. The only example I could find on mediawiki.org is the Nostalgia skin [5].
This was used for Nostalgia because the cluster didn't have any handling for $IP/skins/ like it does for $IP/extensions/. The only thing that should be using Nostalgia is https://nostalgia.wikipedia.org/. And no other skin should be using the pattern Nostalgia uses.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Out of curiosity, what are your reasons for advocating lowercase skin names over the standard camelcase format used throughout the rest of MediaWiki?
-I