Followup r102951: per CR, remove duplicated empty string from API extlinks modules...
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 23 Nov 2011 13:41:39 +0000 (13:41 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 23 Nov 2011 13:41:39 +0000 (13:41 +0000)
includes/api/ApiQueryExtLinksUsage.php
includes/specials/SpecialLinkSearch.php

index a9db9d9..8205378 100644 (file)
@@ -177,7 +177,9 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                global $wgUrlProtocols;
                $protocols = array( '' );
                foreach ( $wgUrlProtocols as $p ) {
-                       $protocols[] = substr( $p, 0, strpos( $p, ':' ) );
+                       if ( $p !== '//' ) {
+                               $protocols[] = substr( $p, 0, strpos( $p, ':' ) );
+                       }
                }
                return $protocols;
        }
index eb42206..6ef3807 100644 (file)
@@ -55,9 +55,10 @@ class LinkSearchPage extends QueryPage {
                $target = $request->getVal( 'target', $par );
                $namespace = $request->getIntorNull( 'namespace', null );
 
-               $protocols_list[] = '';
                foreach( $wgUrlProtocols as $prot ) {
-                       $protocols_list[] = $prot;
+                       if ( $prot !== '//' ) {
+                               $protocols_list[] = $prot;
+                       }
                }
 
                $target2 = $target;
@@ -76,13 +77,13 @@ class LinkSearchPage extends QueryPage {
                        // default
                        $protocol = 'http://';
                }
-               if ( !in_array( $protocol, $protocols_list ) ) {
+               if ( $protocol != '' && !in_array( $protocol, $protocols_list ) ) {
                        // unsupported protocol, show original search request
                        $target2 = $target;
                        $protocol = '';
                }
 
-               $out->addWikiMsg( 'linksearch-text', '<nowiki>' . $this->getLanguage()->commaList( $wgUrlProtocols ) . '</nowiki>' );
+               $out->addWikiMsg( 'linksearch-text', '<nowiki>' . $this->getLanguage()->commaList( $protocols_list ) . '</nowiki>' );
                $s = Xml::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'] ) ) .
                        Html::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) .
                        '<fieldset>' .