Manual:Skin autodiscovery

Skin autodiscovery was a legacy skin installation mechanism used by MediaWiki since very early versions (around 2004) which will be removed in MediaWiki 1.25, after being superseded by an explicit installation method in MediaWiki 1.12 and after being officially deprecated in MediaWiki 1.23. See gerrit change Ib4bdda5ed3c133fce0113eb17fa39950aa812f87 for details.

MediaWiki 1.23 and 1.24 will emit warnings in production if a skin using the deprecated mechanism is found: A skin using autodiscovery mechanism, $aSkin, was found in your skins/ directory. The mechanism will be removed in MediaWiki 1.25 and the skin will no longer be recognized. See https://www.mediawiki.org/wiki/Manual:Skin_autodiscovery for information how to fix this.

Skins using autodiscovery will continue working in the 1.23 LTS release (with the aforementioned warnings). If you upgrade from one LTS version to the next one, you will even have time until 1.27 LTS is released, giving you plenty of time to migrate.

How did autodiscovery work?
It used to be possible to just put a  file in MediaWiki's   directory, which would be loaded and expected to contain the   class. It has been discouraged for a long time because of the limitations of this method (inability to add localisation messages, ResourceLoader modules, etc. without cluttering ) and awkwardness in managing such skins ($wgSkipSkins had to be introduced to make it possible to disable an installed skin).

Since MediaWiki 1.23 this mechanism is officially deprecated.

What should I use instead?
The recommended way to create a skin is detailed on Manual:Skinning.

In short, you would create a subdirectory under  containing your skin's PHP code and assets, define certain skin properties in the   file, which now is located inside that subdirectory, and   it like you do when installing extensions.

This has already been supported, with minor modifications, since MediaWiki 1.12.

Where do I get a new version of my skin?
The bundled skins which come with MediaWiki (like Vector or MonoBook) will continue to be updated with the MediaWiki Core. When you upgrade your installation to MediaWiki 1.24 or newer, you will also get a new version of these skins. (You should then remove the old copies from the  folder, see Manual:Upgrading#Files remaining that may cause errors.)

If the skin you use was written by someone else (and you don't maintain it yourself), first try to find out if its maintainer has updated it already. Most of the skins that have description pages here on mediawiki.org (Category:All skins) use the new mechanism already or will be updated to use it soon (before 1.25 is released).

If you maintain the skin yourself, or if you want to help its maintainer migrating it, go ahead with the next section.

Migration guide
Steps needed to switch a skin to the new mechanism, in short:
 * 1) Move the MySkin.php file into the MySkin directory with skin resources (or create one if it doesn't exist). In the past, skins often used camel-case for the PHP file name and lower-case for the directory. You should now make both names exactly the same - preferred is the camel-case version.
 * 2) * Optionally, split the classes defined by your skin (SkinMySkin, MySkinTemplate) to separate files and register them in $wgAutoloadClasses like so: . This will make the structure of the main file clearer, especially if you have a lot of code or used additional features (see below).
 * 3) Adjust paths in the PHP files if they were relative to file's directory, rather than $IP or $wgStyleDirectory.
 * 4) Add the skin to $wgValidSkinNames in the MySkin.php file, like so:  . Note the capitalisation: The key is lower-case, the value is camel-case as in the class name "SkinMySkin" of the skin.
 * 5) If you used additional MediaWiki features:
 * 6) * If you have somehow defined ResourceLoader modules for your skin (like ), put them in the MySkin.php file as well. Remember to adjust paths if necessary. (No other changes are needed.)
 * 7) * If you have somehow defined localization messages for your skin (using $wgMessagesDirs or $wgExtensionMessagesFiles), move the messages file/directory into the MySkin directory, and place the definition (which looks like or , respectively) in the MySkin.php file.
 * 8) Add a  to your LocalSettings.php file (similarly to how it's done for extensions).

As mentioned above, the "migrated" skins will work with your MediaWiki 1.23 installation, as well as many versions back.

Example
This patch set exemplarily shows how this migration works: https://gerrit.wikimedia.org/r/#/c/138795/