From: Roan Kattouw Date: Fri, 19 Aug 2011 17:33:41 +0000 (+0000) Subject: Use canonical URLs in sitemaps, diff stuff and external edit stuff X-Git-Tag: 1.31.0-rc.0~28164 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=24f6e5f721352a40898eea2a08d4633559fe68b1;p=lhc%2Fweb%2Fwiklou.git Use canonical URLs in sitemaps, diff stuff and external edit stuff --- diff --git a/includes/ExternalEdit.php b/includes/ExternalEdit.php index 7cc63efeef..bf97c1a5e1 100644 --- a/includes/ExternalEdit.php +++ b/includes/ExternalEdit.php @@ -45,7 +45,7 @@ class ExternalEdit { * Output the information for the external editor */ public function edit() { - global $wgOut, $wgScript, $wgScriptPath, $wgServer, $wgLang; + global $wgOut, $wgScript, $wgScriptPath, $wgCanonicalServer, $wgLang; $wgOut->disable(); header( 'Content-type: application/x-external-editor; charset=utf-8' ); header( 'Cache-control: no-cache' ); @@ -56,11 +56,11 @@ class ExternalEdit { if( $this->mode == "file" ) { $type = "Edit file"; $image = wfLocalFile( $this->title ); - $url = $image->getFullURL(); + $url = $image->getCanonicalURL(); $extension = $image->getExtension(); } else { $type = "Edit text"; - $url = $this->title->getFullURL( + $url = $this->title->getCanonicalURL( array( 'action' => 'edit', 'internaledit' => 'true' ) ); # *.wiki file extension is used by some editors for syntax # highlighting, so we follow that convention @@ -76,8 +76,8 @@ class ExternalEdit { [Process] Type=$type Engine=MediaWiki -Script={$wgServer}{$wgScript} -Server={$wgServer} +Script={$wgCanonicalServer}{$wgScript} +Server={$wgCanonicalServer} Path={$wgScriptPath} Special namespace=$special diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 74b909e1d4..30b827df79 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -190,14 +190,14 @@ class DifferenceEngine { # we'll use the application/x-external-editor interface to call # an external diff tool like kompare, kdiff3, etc. if ( $wgUseExternalEditor && $wgUser->getOption( 'externaldiff' ) ) { - global $wgServer, $wgScript, $wgLang; + global $wgCanonicalServer, $wgScript, $wgLang; $wgOut->disable(); header ( "Content-type: application/x-external-editor; charset=UTF-8" ); - $url1 = $this->mTitle->getFullURL( array( + $url1 = $this->mTitle->getCanonical( array( 'action' => 'raw', 'oldid' => $this->mOldid ) ); - $url2 = $this->mTitle->getFullURL( array( + $url2 = $this->mTitle->getCanonical( array( 'action' => 'raw', 'oldid' => $this->mNewid ) ); @@ -206,7 +206,7 @@ class DifferenceEngine { [Process] Type=Diff text Engine=MediaWiki - Script={$wgServer}{$wgScript} + Script={$wgCanonicalServer}{$wgScript} Special namespace={$special} [File] diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index 6fd7f81579..50b3a47b38 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -298,7 +298,7 @@ class GenerateSitemap extends Maintenance { } $title = Title::makeTitle( $row->page_namespace, $row->page_title ); $date = wfTimestamp( TS_ISO_8601, $row->page_touched ); - $entry = $this->fileEntry( $title->getFullURL(), $date, $this->priority( $namespace ) ); + $entry = $this->fileEntry( $title->getCanonicalURL(), $date, $this->priority( $namespace ) ); $length += strlen( $entry ); $this->write( $this->file, $entry ); // generate pages for language variants @@ -306,7 +306,7 @@ class GenerateSitemap extends Maintenance { $variants = $wgContLang->getVariants(); foreach ( $variants as $vCode ) { if ( $vCode == $wgContLang->getCode() ) continue; // we don't want default variant - $entry = $this->fileEntry( $title->getFullURL( '', $vCode ), $date, $this->priority( $namespace ) ); + $entry = $this->fileEntry( $title->getCanonicalURL( '', $vCode ), $date, $this->priority( $namespace ) ); $length += strlen( $entry ); $this->write( $this->file, $entry ); } @@ -456,7 +456,7 @@ class GenerateSitemap extends Maintenance { $this->limit = array( strlen( $this->openFile() ), - strlen( $this->fileEntry( $title->getFullUrl(), wfTimestamp( TS_ISO_8601, wfTimestamp() ), $this->priority( $namespace ) ) ), + strlen( $this->fileEntry( $title->getCanonicalURL(), wfTimestamp( TS_ISO_8601, wfTimestamp() ), $this->priority( $namespace ) ) ), strlen( $this->closeFile() ) ); }