Officially deprecate skin autodiscovery
[lhc/web/wiklou.git] / includes / Skin.php
index 06f39b1..0d165fe 100644 (file)
@@ -63,6 +63,29 @@ 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' ) ) ) {
+                                                       wfLogWarning(
+                                                               "An old copy of the $aSkin skin was found in your skins/ directory. " .
+                                                               "You should remove it to avoid problems in the future." .
+                                                               "See https://www.mediawiki.org/wiki/Manual:Skin_autodiscovery for details."
+                                                       );
+                                                       continue;
+                                               }
+
+                                               wfLogWarning(
+                                                       "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."
+                                               );
                                                $wgValidSkinNames[strtolower( $aSkin )] = $aSkin;
                                        }
                                }
@@ -184,7 +207,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 );