Merge "installer: Link to skin screenshots"
[lhc/web/wiklou.git] / includes / installer / Installer.php
index 7028224..a29d987 100644 (file)
@@ -384,7 +384,7 @@ abstract class Installer {
 
                // make sure we use the installer config as the main config
                $configRegistry = $baseConfig->get( 'ConfigRegistry' );
-               $configRegistry['main'] = function() use ( $installerConfig ) {
+               $configRegistry['main'] = function () use ( $installerConfig ) {
                        return $installerConfig;
                };
 
@@ -446,6 +446,7 @@ abstract class Installer {
                $this->parserTitle = Title::newFromText( 'Installer' );
                $this->parserOptions = new ParserOptions( $wgUser ); // language will be wrong :(
                $this->parserOptions->setEditSection( false );
+               $this->parserOptions->setWrapOutputClass( false );
                // Don't try to access DB before user language is initialised
                $this->setParserLanguage( Language::factory( 'en' ) );
        }
@@ -1339,7 +1340,7 @@ abstract class Installer {
         * Reasonable values for $directory include 'extensions' (the default) and 'skins'.
         *
         * @param string $directory Directory to search in
-        * @return array
+        * @return array [ $extName => [ 'screenshots' => [ '...' ] ]
         */
        public function findExtensions( $directory = 'extensions' ) {
                if ( $this->getVar( 'IP' ) === null ) {
@@ -1361,7 +1362,15 @@ abstract class Installer {
                                continue;
                        }
                        if ( file_exists( "$extDir/$file/$jsonFile" ) || file_exists( "$extDir/$file/$file.php" ) ) {
-                               $exts[] = $file;
+                               // Extension exists. Now see if there are screenshots
+                               $exts[$file] = [];
+                               if ( is_dir( "$extDir/$file/screenshots" ) ) {
+                                       $paths = glob( "$extDir/$file/screenshots/*.png" );
+                                       foreach ( $paths as $path ) {
+                                               $exts[$file]['screenshots'][] = str_replace( $extDir, "../$directory", $path );
+                                       }
+
+                               }
                        }
                }
                closedir( $dh );