http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95017

Revision: 95017
Author:   catrope
Date:     2011-08-19 17:33:41 +0000 (Fri, 19 Aug 2011)
Log Message:
-----------
Use canonical URLs in sitemaps, diff stuff and external edit stuff

Modified Paths:
--------------
    trunk/phase3/includes/ExternalEdit.php
    trunk/phase3/includes/diff/DifferenceEngine.php
    trunk/phase3/maintenance/generateSitemap.php

Modified: trunk/phase3/includes/ExternalEdit.php
===================================================================
--- trunk/phase3/includes/ExternalEdit.php      2011-08-19 17:31:40 UTC (rev 
95016)
+++ trunk/phase3/includes/ExternalEdit.php      2011-08-19 17:33:41 UTC (rev 
95017)
@@ -45,7 +45,7 @@
         * 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 @@
                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 @@
 [Process]
 Type=$type
 Engine=MediaWiki
-Script={$wgServer}{$wgScript}
-Server={$wgServer}
+Script={$wgCanonicalServer}{$wgScript}
+Server={$wgCanonicalServer}
 Path={$wgScriptPath}
 Special namespace=$special
 

Modified: trunk/phase3/includes/diff/DifferenceEngine.php
===================================================================
--- trunk/phase3/includes/diff/DifferenceEngine.php     2011-08-19 17:31:40 UTC 
(rev 95016)
+++ trunk/phase3/includes/diff/DifferenceEngine.php     2011-08-19 17:33:41 UTC 
(rev 95017)
@@ -190,14 +190,14 @@
                # 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 @@
                        [Process]
                        Type=Diff text
                        Engine=MediaWiki
-                       Script={$wgServer}{$wgScript}
+                       Script={$wgCanonicalServer}{$wgScript}
                        Special namespace={$special}
 
                        [File]

Modified: trunk/phase3/maintenance/generateSitemap.php
===================================================================
--- trunk/phase3/maintenance/generateSitemap.php        2011-08-19 17:31:40 UTC 
(rev 95016)
+++ trunk/phase3/maintenance/generateSitemap.php        2011-08-19 17:33:41 UTC 
(rev 95017)
@@ -298,7 +298,7 @@
                                }
                                $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 @@
                                        $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 @@
 
                $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() )
                );
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to