- /**
- * @return array
- */
- private function getLegacySkinNames() {
- static $skinsInitialised = false;
-
- if ( !$skinsInitialised || !count( $this->legacySkins ) ) {
- # Get a list of available skins
- # Build using the regular expression '^(.*).php$'
- # Array keys are all lower case, array value keep the case used by filename
- #
- wfProfileIn( __METHOD__ . '-init' );
-
- global $wgStyleDirectory;
-
- $skinDir = dir( $wgStyleDirectory );
-
- if ( $skinDir !== false && $skinDir !== null ) {
- # while code from www.php.net
- while ( false !== ( $file = $skinDir->read() ) ) {
- // Skip non-PHP files, hidden files, and '.dep' includes
- $matches = array();
-
- 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."
- );
- $this->legacySkins[strtolower( $aSkin )] = $aSkin;
- }
- }
- $skinDir->close();
- }
- $skinsInitialised = true;
- wfProfileOut( __METHOD__ . '-init' );
- }
- return $this->legacySkins;
-
- }
-