Don't use autodiscovery for core skins, move them to separate directories

Step one on the way to killing the autodiscovery mechanism and making
the core skins less intertwined with core.

This only moves the files and fixes hardcoded paths throughout core.
Any further changes will be done in separate patch(es).

Moved files:
* skins/MonoBook.php → skins/monobook/MonoBook.php
* skins/Vector.php   → skins/vector/Vector.php

Bug: 65748
Change-Id: Ib4bdda5ed3c133fce0113eb17fa39950aa812f87
This commit is contained in:
Bartosz Dziewoński 2014-05-25 23:58:05 +02:00 committed by Ori.livneh
parent f87cf660bf
commit 9e6827d7b5
7 changed files with 26 additions and 9 deletions

View file

@ -1180,10 +1180,10 @@ $wgAutoloadLocalClasses = array(
'MyLocalSettingsGenerator' => 'mw-config/overrides.php',
# skins
'MonoBookTemplate' => 'skins/MonoBook.php',
'SkinMonoBook' => 'skins/MonoBook.php',
'SkinVector' => 'skins/Vector.php',
'VectorTemplate' => 'skins/Vector.php',
'MonoBookTemplate' => 'skins/monobook/MonoBook.php',
'SkinMonoBook' => 'skins/monobook/MonoBook.php',
'SkinVector' => 'skins/vector/Vector.php',
'VectorTemplate' => 'skins/vector/Vector.php',
);
class AutoLoader {

View file

@ -601,6 +601,13 @@ $wgTitle = null;
$wgDeferredUpdateList = array();
// Enable default skins.
// This is hacky and bad, but it will go away before 1.24 release (or so I hope).
// These lines should eventually be placed in skins' meta definition files, and loaded by a
// require_once for each skin file generated by the installer and placed in LocalSettings.php.
$wgValidSkinNames['monobook'] = 'MonoBook';
$wgValidSkinNames['vector'] = 'Vector';
wfProfileOut( $fname . '-globals' );
wfProfileIn( $fname . '-extensions' );

View file

@ -63,6 +63,19 @@ abstract class Skin extends ContextSource {
if ( preg_match( '/^([^.]*)\.php$/', $file, $matches ) ) {
$aSkin = $matches[1];
// Explicitly disallow loading core skins via the autodiscovery mechanism.
//
// They should be loaded already (in a non-autodicovery way), but old files might still
// exist on the server because our MW version upgrade process is widely documented as
// requiring just copying over all files, without removing old ones.
//
// This is one of the reasons we should have never used autodiscovery in the first
// place. This hack can be safely removed when autodiscovery is gone.
if ( in_array( $aSkin, array( 'CologneBlue', 'Modern', 'MonoBook', 'Vector' ) ) ) {
continue;
}
$wgValidSkinNames[strtolower( $aSkin )] = $aSkin;
}
}
@ -184,7 +197,6 @@ abstract class Skin extends ContextSource {
# is no longer valid.
wfDebug( "Skin class does not exist: $className\n" );
$className = 'SkinVector';
require_once "{$wgStyleDirectory}/Vector.php";
}
}
$skin = new $className( $key );

View file

@ -1227,7 +1227,7 @@ return array(
'scripts' => 'resources/src/mediawiki.special/mediawiki.special.js',
'styles' => 'resources/src/mediawiki.special/mediawiki.special.css',
'skinStyles' => array(
'vector' => 'skins/vector/special.less',
'vector' => 'skins/vector/special.less', // FIXME this should use $wgStyleDirectory
),
),
'mediawiki.special.block' => array(
@ -1276,7 +1276,7 @@ return array(
'styles' => 'resources/src/mediawiki.special/mediawiki.special.preferences.css',
'position' => 'top',
'skinStyles' => array(
'vector' => 'skins/vector/special.preferences.less',
'vector' => 'skins/vector/special.preferences.less', // FIXME this should use $wgStyleDirectory
),
'messages' => array(
'prefs-tabs-navigation-hint',

2
skins/.gitignore vendored
View file

@ -7,5 +7,3 @@
!vector/*
*.php
!MonoBook.php
!Vector.php