Merge "DatabaseMssql: Don't duplicate body of makeList()"
[lhc/web/wiklou.git] / includes / specials / SpecialVersion.php
index 3747e92..a7365bb 100644 (file)
@@ -109,12 +109,7 @@ class SpecialVersion extends SpecialPage {
                                        $file = $this->getExtLicenseFileName( dirname( $extNode['path'] ) );
                                        if ( $file ) {
                                                $wikiText = file_get_contents( $file );
-                                               if ( !isset( $extNode['license-name'] ) ) {
-                                                       // If the developer did not explicitly set license-name they probably
-                                                       // are unaware that we're now sucking this file in and thus it's probably
-                                                       // not wikitext friendly.
-                                                       $wikiText = "<pre>$wikiText</pre>";
-                                               }
+                                               $wikiText = "<pre>$wikiText</pre>";
                                        }
                                }
 
@@ -252,7 +247,6 @@ class SpecialVersion extends SpecialPage {
         */
        public static function getVersion( $flags = '' ) {
                global $wgVersion, $IP;
-               wfProfileIn( __METHOD__ );
 
                $gitInfo = self::getGitHeadSha1( $IP );
                $svnInfo = self::getSvnInfo( $IP );
@@ -276,8 +270,6 @@ class SpecialVersion extends SpecialPage {
                                )->text();
                }
 
-               wfProfileOut( __METHOD__ );
-
                return $version;
        }
 
@@ -291,7 +283,6 @@ class SpecialVersion extends SpecialPage {
         */
        public static function getVersionLinked() {
                global $wgVersion;
-               wfProfileIn( __METHOD__ );
 
                $gitVersion = self::getVersionLinkedGit();
                if ( $gitVersion ) {
@@ -305,8 +296,6 @@ class SpecialVersion extends SpecialPage {
                        }
                }
 
-               wfProfileOut( __METHOD__ );
-
                return $v;
        }
 
@@ -531,11 +520,16 @@ class SpecialVersion extends SpecialPage {
                        . 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' );
@@ -556,7 +550,7 @@ class SpecialVersion extends SpecialPage {
                if ( count( $tags ) ) {
                        $out = Html::rawElement(
                                'h2',
-                               array( 'class' => 'mw-headline' ),
+                               array( 'class' => 'mw-headline plainlinks' ),
                                Linker::makeExternalLink(
                                        '//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Tag_extensions',
                                        $this->msg( 'version-parser-extensiontags' )->parse(),
@@ -594,7 +588,7 @@ class SpecialVersion extends SpecialPage {
 
                $fhooks = $wgParser->getFunctionHooks();
                if ( count( $fhooks ) ) {
-                       $out = Html::rawElement( 'h2', array( 'class' => 'mw-headline' ), Linker::makeExternalLink(
+                       $out = Html::rawElement( 'h2', array( 'class' => 'mw-headline plainlinks' ), Linker::makeExternalLink(
                                '//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Parser_functions',
                                $this->msg( 'version-parser-function-hooks' )->parse(),
                                false /* msg()->parse() already escapes */
@@ -729,7 +723,7 @@ class SpecialVersion extends SpecialPage {
                        list( $vcsVersion, $vcsLink, $vcsDate ) = $cache->get( $memcKey );
 
                        if ( !$vcsVersion ) {
-                               wfDebug( "Getting VCS info for extension $extensionName" );
+                               wfDebug( "Getting VCS info for extension {$extension['name']}" );
                                $gitInfo = new GitInfo( $extensionPath );
                                $vcsVersion = $gitInfo->getHeadSHA1();
                                if ( $vcsVersion !== false ) {
@@ -745,7 +739,7 @@ class SpecialVersion extends SpecialPage {
                                }
                                $cache->set( $memcKey, array( $vcsVersion, $vcsLink, $vcsDate ), 60 * 60 * 24 );
                        } else {
-                               wfDebug( "Pulled VCS info for extension $extensionName from cache" );
+                               wfDebug( "Pulled VCS info for extension {$extension['name']} from cache" );
                        }
                }
 
@@ -788,24 +782,23 @@ class SpecialVersion extends SpecialPage {
                // ... 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
@@ -833,12 +826,12 @@ class SpecialVersion extends SpecialPage {
 
                // ... now get the authors for this extension
                $authors = isset( $extension['author'] ) ? $extension['author'] : array();
-               $authors = $this->listAuthors( $authors, $extensionName, $extensionPath );
+               $authors = $this->listAuthors( $authors, $extension['name'], $extensionPath );
 
                // Finally! Create the table
                $html = Html::openElement( 'tr', array(
                                'class' => 'mw-version-ext',
-                               'id' => "mw-version-ext-{$extensionName}"
+                               'id' => "mw-version-ext-{$extension['name']}"
                        )
                );
 
@@ -971,10 +964,10 @@ class SpecialVersion extends SpecialPage {
                                if ( $this->getExtAuthorsFileName( $extDir ) ) {
                                        $text = Linker::link(
                                                $this->getPageTitle( "Credits/$extName" ),
-                                               $this->msg( 'version-poweredby-others' )->text()
+                                               $this->msg( 'version-poweredby-others' )->escaped()
                                        );
                                } else {
-                                       $text = $this->msg( 'version-poweredby-others' )->text();
+                                       $text = $this->msg( 'version-poweredby-others' )->escaped();
                                }
                                $list[] = $text;
                        } elseif ( substr( $item, -5 ) == ' ...]' ) {
@@ -990,7 +983,7 @@ class SpecialVersion extends SpecialPage {
                if ( !$hasOthers && $this->getExtAuthorsFileName( $extDir ) ) {
                        $list[] = $text = Linker::link(
                                $this->getPageTitle( "Credits/$extName" ),
-                               $this->msg( 'version-poweredby-others' )->text()
+                               $this->msg( 'version-poweredby-others' )->escaped()
                        );
                }