Merge "Always use the canonical extension name to link the license file"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 6 Jan 2015 15:54:31 +0000 (15:54 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 6 Jan 2015 15:54:31 +0000 (15:54 +0000)
1  2 
includes/specials/SpecialVersion.php

@@@ -531,16 -531,11 +531,16 @@@ class SpecialVersion extends SpecialPag
                        . Html::element( 'th', array(), $this->msg( 'version-libraries-library' )->text() )
                        . Html::element( 'th', array(), $this->msg( 'version-libraries-version' )->text() )
                        . Html::closeElement( 'tr' );
 -              ;
 -              foreach ( $lock->getInstalledDependencies() as $name => $version ) {
 +
 +              foreach ( $lock->getInstalledDependencies() as $name => $info ) {
 +                      if ( strpos( $info['type'], 'mediawiki-' ) === 0 ) {
 +                              // Skip any extensions or skins since they'll be listed
 +                              // in their proper section
 +                              continue;
 +                      }
                        $out .= Html::openElement( 'tr' )
                                . Html::rawElement( 'td', array(), Linker::makeExternalLink( "https://packagist.org/packages/$name", $name ) )
 -                              . Html::element( 'td', array(), $version )
 +                              . Html::element( 'td', array(), $info['version'] )
                                . Html::closeElement( 'tr' );
                }
                $out .= Html::closeElement( 'table' );
                // ... and license information; if a license file exists we
                // will link to it
                $licenseLink = '';
-               if ( isset( $extension['license-name'] ) ) {
-                       $licenseLink = Linker::link(
-                               $this->getPageTitle( 'License/' . $extensionName ),
-                               $out->parseInline( $extension['license-name'] ),
-                               array(
-                                       'class' => 'mw-version-ext-license',
-                                       'dir' => 'auto',
-                               )
-                       );
-               } elseif ( $this->getExtLicenseFileName( $extensionPath ) ) {
-                       $licenseLink = Linker::link(
-                               $this->getPageTitle( 'License/' . $extensionName ),
-                               $this->msg( 'version-ext-license' ),
-                               array(
-                                       'class' => 'mw-version-ext-license',
-                                       'dir' => 'auto',
-                               )
-                       );
+               if ( isset( $extension['name'] ) ) {
+                       $licenseName = null;
+                       if ( isset( $extension['license-name'] ) ) {
+                               $licenseName = $out->parseInline( $extension['license-name'] );
+                       } elseif ( $this->getExtLicenseFileName( $extensionPath ) ) {
+                               $licenseName = $this->msg( 'version-ext-license' );
+                       }
+                       if ( $licenseName !== null ) {
+                               $licenseLink = Linker::link(
+                                       $this->getPageTitle( 'License/' . $extension['name'] ),
+                                       $licenseName,
+                                       array(
+                                               'class' => 'mw-version-ext-license',
+                                               'dir' => 'auto',
+                                       )
+                               );
+                       }
                }
  
                // ... and generate the description; which can be a parameterized l10n message