return $maybeDir !== '.' && $maybeDir !== '..' && is_dir( "$styleDirectory/$maybeDir" );
} );
- // Only keep the ones that contain a .php file with the same name inside
+ // Filter out skins that aren't installed
$possibleSkins = array_filter( $possibleSkins, function ( $skinDir ) use ( $styleDirectory ) {
- return is_file( "$styleDirectory/$skinDir/$skinDir.php" );
+ return
+ is_file( "$styleDirectory/$skinDir/skin.json" )
+ || is_file( "$styleDirectory/$skinDir/$skinDir.php" );
} );
return $possibleSkins;
} else {
$skinsInstalledText[] = $this->getMsg( 'default-skin-not-found-row-disabled' )
->params( $normalizedKey, $skin )->plain();
- $skinsInstalledSnippet[] = "require_once \"\$IP/skins/$skin/$skin.php\";";
+ $skinsInstalledSnippet[] = $this->getSnippetForSkin( $skin );
}
}
}
}
+ /**
+ * Get the appropriate LocalSettings.php snippet to enable the given skin
+ *
+ * @param string $skin
+ * @return string
+ */
+ private function getSnippetForSkin( $skin ) {
+ global $IP;
+ if ( file_exists( "$IP/skins/$skin/skin.json" ) ) {
+ return "wfLoadSkin( '$skin' );";
+ } else {
+ return "require_once \"\$IP/skins/$skin/$skin.php\";";
+ }
+ }
+
/**
* Outputs the entire contents of the page. No navigation (other than search box), just the big
* warning message and page content.