r95000 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94999‎ | r95000 | r95001 >
Date:14:39, 19 August 2011
Author:catrope
Status:ok
Tags:
Comment:
Use canonical URLs (introduced in r94995) in the OpenSearch discovery thingy
Modified paths:
  • /trunk/extensions/OpenSearchXml/OpenSearchXml.php (modified) (history)
  • /trunk/phase3/includes/search/SearchEngine.php (modified) (history)
  • /trunk/phase3/opensearch_desc.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/search/SearchEngine.php
@@ -472,7 +472,7 @@
473473 * @return String
474474 */
475475 public static function getOpenSearchTemplate() {
476 - global $wgOpenSearchTemplate, $wgServer;
 476+ global $wgOpenSearchTemplate, $wgCanonicalServer;
477477 if ( $wgOpenSearchTemplate ) {
478478 return $wgOpenSearchTemplate;
479479 } else {
@@ -480,7 +480,7 @@
481481 if ( !$ns ) {
482482 $ns = "0";
483483 }
484 - return $wgServer . wfScript( 'api' ) . '?action=opensearch&search={searchTerms}&namespace=' . $ns;
 484+ return $wgCanonicalServer . wfScript( 'api' ) . '?action=opensearch&search={searchTerms}&namespace=' . $ns;
485485 }
486486 }
487487
Index: trunk/phase3/opensearch_desc.php
@@ -51,7 +51,7 @@
5252 'height' => 16,
5353 'width' => 16,
5454 'type' => 'image/x-icon' ),
55 - wfExpandUrl( $wgFavicon ) );
 55+ wfExpandUrl( $wgFavicon , PROTO_CURRENT ) );
5656
5757 $urls = array();
5858
@@ -62,7 +62,7 @@
6363 $urls[] = array(
6464 'type' => 'text/html',
6565 'method' => 'get',
66 - 'template' => $searchPage->getFullURL( 'search={searchTerms}' ) );
 66+ 'template' => $searchPage->getCanonicalURL( 'search={searchTerms}' ) );
6767
6868 if( $wgEnableAPI ) {
6969 // JSON interface for search suggestions.
@@ -86,6 +86,6 @@
8787 // sends you to the domain root if you hit "enter" with an empty
8888 // search box.
8989 print Xml::element( 'moz:SearchForm', null,
90 - $searchPage->getFullUrl() );
 90+ $searchPage->getCanonicalURL() );
9191
9292 print '</OpenSearchDescription>';
Index: trunk/extensions/OpenSearchXml/OpenSearchXml.php
@@ -52,10 +52,10 @@
5353 }
5454
5555 function efOpenSearchXmlTemplate() {
56 - global $wgServer, $wgScriptPath;
 56+ global $wgCanonicalServer, $wgScriptPath;
5757 $ns = implode( '|', SearchEngine::defaultNamespaces() );
5858 if( !$ns ) {
5959 $ns = '0';
6060 }
61 - return $wgServer . $wgScriptPath . '/api.php?action=opensearch&format=xml&search={searchTerms}&namespace=' . $ns;
 61+ return $wgCanonicalServer . $wgScriptPath . '/api.php?action=opensearch&format=xml&search={searchTerms}&namespace=' . $ns;
6262 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r955051.17wmf1: Merge a truckload of HTTPS / prot rel URL fixes: r93847, r94990, r9...catrope19:32, 25 August 2011
r964751.18: MFT r94737, r94990, r95000, r95001, r95002, r95006, r95007, r95010, r95...catrope19:37, 7 September 2011
r96478Followup r96475: merge the rest of r95000 toocatrope19:45, 7 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r94995Per CR on r44412 and my promise in the commit summary of r94990, stop abusing...catrope11:23, 19 August 2011

Status & tagging log