Use canonical URLs in sitemaps, diff stuff and external edit stuff
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 17:33:41 +0000 (17:33 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 19 Aug 2011 17:33:41 +0000 (17:33 +0000)
includes/ExternalEdit.php
includes/diff/DifferenceEngine.php
maintenance/generateSitemap.php

index 7cc63ef..bf97c1a 100644 (file)
@@ -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
 
index 74b909e..30b827d 100644 (file)
@@ -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]
index 6fd7f81..50b3a47 100644 (file)
@@ -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() )
                );
        }