http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95659
Revision: 95659
Author: catrope
Date: 2011-08-29 12:33:53 +0000 (Mon, 29 Aug 2011)
Log Message:
-----------
Switch to using canonical URLs where appropriate in various extensions
* ActiveAbstract: output is stored XML, as I understand it, so use canonical
URLs throughout
* AbuseFilter: URLs go into log entries and need to be fully-qualified for the
format to work
* EmailCapture: URLs go into e-mails
* SecurePoll: one URL goes to an XML file, make that one canonical. Made the
URLs identifying users canonical too, because they would otherwise change when
$wgServer is made protocol-relative and possibly break SecurePoll. Of course
this means SP might still break if and when we change $wgCanonicalServer to
point to HTTPS, but we'll worry about that later
* DoubleWiki: the surrounding code looks scary, but from what I can tell it
seems to assume the URL starts with a protocol, then derive some data from it
and put it in memcached. That means a canonical URL is needed so the protocol
assumption is still valid and the cache isn't polluted
* OAI: use canonical URLs throughout
* LiquidThreads: use canonical URL in e-mail
Modified Paths:
--------------
trunk/extensions/AbuseFilter/AbuseFilter.class.php
trunk/extensions/ActiveAbstract/AbstractFilter.php
trunk/extensions/ActiveAbstract/GoogleCoopFilter.php
trunk/extensions/DoubleWiki/DoubleWiki_body.php
trunk/extensions/EmailCapture/api/ApiEmailCapture.php
trunk/extensions/LiquidThreads/classes/NewMessagesController.php
trunk/extensions/LiquidThreads/classes/View.php
trunk/extensions/OAI/OAIRepo_body.php
trunk/extensions/SecurePoll/includes/entities/Election.php
trunk/extensions/SecurePoll/includes/user/Auth.php
Modified: trunk/extensions/AbuseFilter/AbuseFilter.class.php
===================================================================
--- trunk/extensions/AbuseFilter/AbuseFilter.class.php 2011-08-29 12:28:26 UTC
(rev 95658)
+++ trunk/extensions/AbuseFilter/AbuseFilter.class.php 2011-08-29 12:33:53 UTC
(rev 95659)
@@ -1644,12 +1644,12 @@
static function modifyActionText( $page, $type, $title, $sk, $args ) {
list( $history_id, $filter_id ) = $args;
- $filter_link = $sk ? $sk->link( $title ) : $title->getFullURL();
+ $filter_link = $sk ? $sk->link( $title ) :
$title->getCanonicalURL();
$details_title = SpecialPage::getTitleFor( 'AbuseFilter',
"history/$filter_id/diff/prev/$history_id" );
$details_text = wfMsgExt( 'abusefilter-log-detailslink',
'parseinline' );
$details_link =
- $sk ? $sk->link( $details_title, $details_text ) :
$details_title->getFullURL();
+ $sk ? $sk->link( $details_title, $details_text ) :
$details_title->getCanonicalURL();
return wfMsgExt( 'abusefilter-log-entry-modify',
array( 'parseinline', 'replaceafter' ), array(
$filter_link, $details_link ) );
Modified: trunk/extensions/ActiveAbstract/AbstractFilter.php
===================================================================
--- trunk/extensions/ActiveAbstract/AbstractFilter.php 2011-08-29 12:28:26 UTC
(rev 95658)
+++ trunk/extensions/ActiveAbstract/AbstractFilter.php 2011-08-29 12:33:53 UTC
(rev 95659)
@@ -55,7 +55,7 @@
$xml = "<doc>\n";
$xml .= Xml::element( 'title', null, $this->_variant( $title )
) . "\n";
- $xml .= Xml::element( 'url', null, $this->title->getFullUrl() )
. "\n";
+ $xml .= Xml::element( 'url', null,
$this->title->getCanonicalUrl() ) . "\n";
// add abstract and links when we have revision data...
$this->revision = null;
@@ -216,7 +216,7 @@
$stripped = $this->_stripMarkup( $inside ); // strip
internal markup and <h[1-6]>
$header = UtfNormal::cleanUp( $stripped );
$anchor = EditPage::sectionAnchor( $header );
- $url = $this->title->getFullUrl() . $anchor;
+ $url = $this->title->getCanonicalUrl() . $anchor;
$headers[$header] = $url;
}
return $headers;
@@ -239,7 +239,7 @@
$links = array();
while ( $row = $dbr->fetchObject( $result ) ) {
$category = Title::makeTitle( NS_CATEGORY, $row->cl_to
);
- $links[$category->getText()] = $category->getFullUrl();
+ $links[$category->getText()] =
$category->getCanonicalUrl();
}
$dbr->freeResult( $result );
Modified: trunk/extensions/ActiveAbstract/GoogleCoopFilter.php
===================================================================
--- trunk/extensions/ActiveAbstract/GoogleCoopFilter.php 2011-08-29
12:28:26 UTC (rev 95658)
+++ trunk/extensions/ActiveAbstract/GoogleCoopFilter.php 2011-08-29
12:33:53 UTC (rev 95659)
@@ -72,7 +72,7 @@
$xml .= ' ' . Xml::element( 'Output', array( 'name' =>
'title' ),
$wgSitename . ':' .
$this->title->getPrefixedText() ) . "\n";
$xml .= ' ' . Xml::element( 'Output', array( 'name' =>
'more_url' ),
- $this->title->getFullUrl() ) . "\n";
+ $this->title->getCanonicalUrl() ) . "\n";
// add abstract and links when we have revision data...
$this->revision = null;
Modified: trunk/extensions/DoubleWiki/DoubleWiki_body.php
===================================================================
--- trunk/extensions/DoubleWiki/DoubleWiki_body.php 2011-08-29 12:28:26 UTC
(rev 95658)
+++ trunk/extensions/DoubleWiki/DoubleWiki_body.php 2011-08-29 12:33:53 UTC
(rev 95659)
@@ -74,7 +74,7 @@
if( $cachedText ) {
$text = $cachedText;
} else {
- $url = $nt->getFullURL();
+ $url = $nt->getCanonicalURL();
$myURL =
$out->getTitle()->getLocalURL();
$languageName =
$wgContLang->getLanguageName( $iw );
$myLanguage = $wgLang->getLanguageName(
$wgContLang->getCode() );
Modified: trunk/extensions/EmailCapture/api/ApiEmailCapture.php
===================================================================
--- trunk/extensions/EmailCapture/api/ApiEmailCapture.php 2011-08-29
12:28:26 UTC (rev 95658)
+++ trunk/extensions/EmailCapture/api/ApiEmailCapture.php 2011-08-29
12:33:53 UTC (rev 95659)
@@ -33,8 +33,8 @@
// Send auto-response
global $wgEmailCaptureSendAutoResponse,
$wgEmailCaptureAutoResponse;
$title = SpecialPage::getTitleFor( 'EmailCapture' );
- $link = $title->getFullURL();
- $fullLink = $title->getFullURL( array( 'verify' =>
$code ) );
+ $link = $title->getCanonicalURL();
+ $fullLink = $title->getCanonicalURL( array( 'verify' =>
$code ) );
if ( $wgEmailCaptureSendAutoResponse ) {
UserMailer::send(
new MailAddress( $params['email'] ),
Modified: trunk/extensions/LiquidThreads/classes/NewMessagesController.php
===================================================================
--- trunk/extensions/LiquidThreads/classes/NewMessagesController.php
2011-08-29 12:28:26 UTC (rev 95658)
+++ trunk/extensions/LiquidThreads/classes/NewMessagesController.php
2011-08-29 12:33:53 UTC (rev 95659)
@@ -285,7 +285,7 @@
global $wgPasswordSender;
$link_title = clone $t->getTitle();
$link_title->setFragment( '#' . $t->getAnchorName() );
- $permalink = LqtView::linkInContextFullURL( $t );
+ $permalink = LqtView::linkInContextCanonicalURL( $t );
$talkPage = $t->getTitle()->getPrefixedText();
$from = new MailAddress( $wgPasswordSender, 'WikiAdmin' );
$threadSubject = $t->subject();
Modified: trunk/extensions/LiquidThreads/classes/View.php
===================================================================
--- trunk/extensions/LiquidThreads/classes/View.php 2011-08-29 12:28:26 UTC
(rev 95658)
+++ trunk/extensions/LiquidThreads/classes/View.php 2011-08-29 12:33:53 UTC
(rev 95659)
@@ -161,7 +161,13 @@
return $title->getFullURL( $query );
}
+
+ static function linkInContextCanonicalURL( $thread, $contextType =
'page' ) {
+ list( $title, $query ) = self::linkInContextData( $thread,
$contextType );
+ return $title->getCanonicalURL( $query );
+ }
+
static function diffQuery( $thread, $revision ) {
$changed_thread = $revision->getChangeObject();
$curr_rev_id = $changed_thread->rootRevision();
Modified: trunk/extensions/OAI/OAIRepo_body.php
===================================================================
--- trunk/extensions/OAI/OAIRepo_body.php 2011-08-29 12:28:26 UTC (rev
95658)
+++ trunk/extensions/OAI/OAIRepo_body.php 2011-08-29 12:33:53 UTC (rev
95659)
@@ -550,7 +550,7 @@
function baseUrl() {
$title =& SpecialPage::getTitleFor( 'OAIRepository' );
- return $title->getFullUrl();
+ return $title->getCanonicalUrl();
}
function earliestDatestamp() {
@@ -839,7 +839,7 @@
oaiTag( 'dc:language', array(), $wgContLanguageCode
) . "\n" .
oaiTag( 'dc:type', array(), 'Text' ) . "\n" .
oaiTag( 'dc:format', array(), $wgMimeType ) . "\n"
.
- oaiTag( 'dc:identifier', array(), $title->getFullUrl()
) . "\n" .
+ oaiTag( 'dc:identifier', array(),
$title->getCanonicalUrl() ) . "\n" .
oaiTag( 'dc:contributor', array(),
$this->_row->rev_user_text ) . "\n" .
oaiTag( 'dc:date', array(), oaiDatestamp(
$this->getDatestamp() ) ) . "\n" .
"</oai_dc:dc>\n";
Modified: trunk/extensions/SecurePoll/includes/entities/Election.php
===================================================================
--- trunk/extensions/SecurePoll/includes/entities/Election.php 2011-08-29
12:28:26 UTC (rev 95658)
+++ trunk/extensions/SecurePoll/includes/entities/Election.php 2011-08-29
12:33:53 UTC (rev 95659)
@@ -379,7 +379,7 @@
Xml::element( 'auth', array(), 'local' ) . "\n"
.
Xml::element( 'property',
array( 'name' => 'jump-url' ),
-
$this->context->getSpecialTitle()->getFullURL()
+
$this->context->getSpecialTitle()->getCanonicalUrl()
) . "\n" .
Xml::element( 'property',
array( 'name' => 'jump-id' ),
Modified: trunk/extensions/SecurePoll/includes/user/Auth.php
===================================================================
--- trunk/extensions/SecurePoll/includes/user/Auth.php 2011-08-29 12:28:26 UTC
(rev 95658)
+++ trunk/extensions/SecurePoll/includes/user/Auth.php 2011-08-29 12:33:53 UTC
(rev 95659)
@@ -205,7 +205,7 @@
'name' => $user->getName(),
'type' => 'local',
'domain' => preg_replace( '!.*/(.*)$!', '$1', $wgServer
),
- 'url' => $user->getUserPage()->getFullURL(),
+ 'url' => $user->getUserPage()->getCanonicalURL(),
'properties' => array(
'wiki' => wfWikiID(),
'blocked' => $user->isBlocked(),
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs