Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/135383

Change subject: Don't use autodiscovery for core skins
......................................................................

Don't use autodiscovery for core skins

Step one on the way to killing the mechanism.

I'll move files in a separate commit to keep the diffs reviewable.

Bug: 65748
Change-Id: Ib4bdda5ed3c133fce0113eb17fa39950aa812f87
---
M includes/Setup.php
M includes/Skin.php
2 files changed, 22 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/83/135383/1

diff --git a/includes/Setup.php b/includes/Setup.php
index a1bca22..7276766 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -601,6 +601,15 @@
 
 $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 generated by the installer and placed in 
DefaultSettings.php,
+// along with a require_once for each skin file (instead of loading them via 
AutoLoader like now).
+$wgValidSkinNames['cologneblue'] = 'CologneBlue';
+$wgValidSkinNames['modern'] = 'Modern';
+$wgValidSkinNames['monobook'] = 'MonoBook';
+$wgValidSkinNames['vector'] = 'Vector';
+
 wfProfileOut( $fname . '-globals' );
 wfProfileIn( $fname . '-extensions' );
 
diff --git a/includes/Skin.php b/includes/Skin.php
index c428079..6a6b104 100644
--- a/includes/Skin.php
+++ b/includes/Skin.php
@@ -64,6 +64,19 @@
 
                                        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;
                                        }
                                }
@@ -185,7 +198,6 @@
                                # is no longer valid.
                                wfDebug( "Skin class does not exist: 
$className\n" );
                                $className = 'SkinVector';
-                               require_once "{$wgStyleDirectory}/Vector.php";
                        }
                }
                $skin = new $className( $key );

-- 
To view, visit https://gerrit.wikimedia.org/r/135383
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4bdda5ed3c133fce0113eb17fa39950aa812f87
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to