r104033 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104032‎ | r104033 | r104034 >
Date:13:41, 23 November 2011
Author:catrope
Status:ok
Tags:
Comment:
Followup r102951: per CR, remove duplicated empty string from API extlinks modules' protocol params, and remove // from the list of protocols on Special:LinkSearch
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryExtLinksUsage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialLinkSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryExtLinksUsage.php
@@ -177,7 +177,9 @@
178178 global $wgUrlProtocols;
179179 $protocols = array( '' );
180180 foreach ( $wgUrlProtocols as $p ) {
181 - $protocols[] = substr( $p, 0, strpos( $p, ':' ) );
 181+ if ( $p !== '//' ) {
 182+ $protocols[] = substr( $p, 0, strpos( $p, ':' ) );
 183+ }
182184 }
183185 return $protocols;
184186 }
Index: trunk/phase3/includes/specials/SpecialLinkSearch.php
@@ -55,9 +55,10 @@
5656 $target = $request->getVal( 'target', $par );
5757 $namespace = $request->getIntorNull( 'namespace', null );
5858
59 - $protocols_list[] = '';
6059 foreach( $wgUrlProtocols as $prot ) {
61 - $protocols_list[] = $prot;
 60+ if ( $prot !== '//' ) {
 61+ $protocols_list[] = $prot;
 62+ }
6263 }
6364
6465 $target2 = $target;
@@ -76,13 +77,13 @@
7778 // default
7879 $protocol = 'http://';
7980 }
80 - if ( !in_array( $protocol, $protocols_list ) ) {
 81+ if ( $protocol != '' && !in_array( $protocol, $protocols_list ) ) {
8182 // unsupported protocol, show original search request
8283 $target2 = $target;
8384 $protocol = '';
8485 }
8586
86 - $out->addWikiMsg( 'linksearch-text', '<nowiki>' . $this->getLanguage()->commaList( $wgUrlProtocols ) . '</nowiki>' );
 87+ $out->addWikiMsg( 'linksearch-text', '<nowiki>' . $this->getLanguage()->commaList( $protocols_list ) . '</nowiki>' );
8788 $s = Xml::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'] ) ) .
8889 Html::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) .
8990 '<fieldset>' .

Sign-offs

UserFlagDate
Reedyinspected16:22, 24 November 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r104179REL1_18 MFT r103328, r103634, r103672, r103677, r104033reedy16:27, 24 November 2011
r104181Followup r104033, explicitly define the arrayreedy16:28, 24 November 2011
r107956MFT r104030, r104033, r104146, r104671reedy22:45, 3 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102951(bug 29854) Store protocol-relative links twice in the externallinks table, o...catrope09:13, 14 November 2011

Status & tagging log