r95017 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95016‎ | r95017 | r95018 >
Date:17:33, 19 August 2011
Author:catrope
Status:ok
Tags:
Comment:
Use canonical URLs in sitemaps, diff stuff and external edit stuff
Modified paths:
  • /trunk/phase3/includes/ExternalEdit.php (modified) (history)
  • /trunk/phase3/includes/diff/DifferenceEngine.php (modified) (history)
  • /trunk/phase3/maintenance/generateSitemap.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/generateSitemap.php
@@ -298,7 +298,7 @@
299299 }
300300 $title = Title::makeTitle( $row->page_namespace, $row->page_title );
301301 $date = wfTimestamp( TS_ISO_8601, $row->page_touched );
302 - $entry = $this->fileEntry( $title->getFullURL(), $date, $this->priority( $namespace ) );
 302+ $entry = $this->fileEntry( $title->getCanonicalURL(), $date, $this->priority( $namespace ) );
303303 $length += strlen( $entry );
304304 $this->write( $this->file, $entry );
305305 // generate pages for language variants
@@ -306,7 +306,7 @@
307307 $variants = $wgContLang->getVariants();
308308 foreach ( $variants as $vCode ) {
309309 if ( $vCode == $wgContLang->getCode() ) continue; // we don't want default variant
310 - $entry = $this->fileEntry( $title->getFullURL( '', $vCode ), $date, $this->priority( $namespace ) );
 310+ $entry = $this->fileEntry( $title->getCanonicalURL( '', $vCode ), $date, $this->priority( $namespace ) );
311311 $length += strlen( $entry );
312312 $this->write( $this->file, $entry );
313313 }
@@ -456,7 +456,7 @@
457457
458458 $this->limit = array(
459459 strlen( $this->openFile() ),
460 - strlen( $this->fileEntry( $title->getFullUrl(), wfTimestamp( TS_ISO_8601, wfTimestamp() ), $this->priority( $namespace ) ) ),
 460+ strlen( $this->fileEntry( $title->getCanonicalURL(), wfTimestamp( TS_ISO_8601, wfTimestamp() ), $this->priority( $namespace ) ) ),
461461 strlen( $this->closeFile() )
462462 );
463463 }
Index: trunk/phase3/includes/diff/DifferenceEngine.php
@@ -190,14 +190,14 @@
191191 # we'll use the application/x-external-editor interface to call
192192 # an external diff tool like kompare, kdiff3, etc.
193193 if ( $wgUseExternalEditor && $wgUser->getOption( 'externaldiff' ) ) {
194 - global $wgServer, $wgScript, $wgLang;
 194+ global $wgCanonicalServer, $wgScript, $wgLang;
195195 $wgOut->disable();
196196 header ( "Content-type: application/x-external-editor; charset=UTF-8" );
197 - $url1 = $this->mTitle->getFullURL( array(
 197+ $url1 = $this->mTitle->getCanonical( array(
198198 'action' => 'raw',
199199 'oldid' => $this->mOldid
200200 ) );
201 - $url2 = $this->mTitle->getFullURL( array(
 201+ $url2 = $this->mTitle->getCanonical( array(
202202 'action' => 'raw',
203203 'oldid' => $this->mNewid
204204 ) );
@@ -206,7 +206,7 @@
207207 [Process]
208208 Type=Diff text
209209 Engine=MediaWiki
210 - Script={$wgServer}{$wgScript}
 210+ Script={$wgCanonicalServer}{$wgScript}
211211 Special namespace={$special}
212212
213213 [File]
Index: trunk/phase3/includes/ExternalEdit.php
@@ -45,7 +45,7 @@
4646 * Output the information for the external editor
4747 */
4848 public function edit() {
49 - global $wgOut, $wgScript, $wgScriptPath, $wgServer, $wgLang;
 49+ global $wgOut, $wgScript, $wgScriptPath, $wgCanonicalServer, $wgLang;
5050 $wgOut->disable();
5151 header( 'Content-type: application/x-external-editor; charset=utf-8' );
5252 header( 'Cache-control: no-cache' );
@@ -56,11 +56,11 @@
5757 if( $this->mode == "file" ) {
5858 $type = "Edit file";
5959 $image = wfLocalFile( $this->title );
60 - $url = $image->getFullURL();
 60+ $url = $image->getCanonicalURL();
6161 $extension = $image->getExtension();
6262 } else {
6363 $type = "Edit text";
64 - $url = $this->title->getFullURL(
 64+ $url = $this->title->getCanonicalURL(
6565 array( 'action' => 'edit', 'internaledit' => 'true' ) );
6666 # *.wiki file extension is used by some editors for syntax
6767 # highlighting, so we follow that convention
@@ -76,8 +76,8 @@
7777 [Process]
7878 Type=$type
7979 Engine=MediaWiki
80 -Script={$wgServer}{$wgScript}
81 -Server={$wgServer}
 80+Script={$wgCanonicalServer}{$wgScript}
 81+Server={$wgCanonicalServer}
8282 Path={$wgScriptPath}
8383 Special namespace=$special
8484

Follow-up revisions

RevisionCommit summaryAuthorDate
r955051.17wmf1: Merge a truckload of HTTPS / prot rel URL fixes: r93847, r94990, r9...catrope19:32, 25 August 2011
r964851.18: MFT protocol-relative URL saga: r95014, r95016, r95017, r95627, r95651,...catrope20:14, 7 September 2011

Status & tagging log