r79417 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79416‎ | r79417 | r79418 >
Date:12:30, 1 January 2011
Author:hartman
Status:resolved (Comments)
Tags:
Comment:
Make LiquidThreads use relative URLs instead of absolute URLs.
Fixes bug #26526
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/Dispatch.php (modified) (history)
  • /trunk/extensions/LiquidThreads/classes/View.php (modified) (history)
  • /trunk/extensions/LiquidThreads/compat/HTMLForm.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/TalkpageView.php (modified) (history)
  • /trunk/extensions/LiquidThreads/pages/ThreadPermalinkView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/compat/HTMLForm.php
@@ -175,7 +175,7 @@
176176 return Xml::tags(
177177 'form',
178178 array(
179 - 'action' => $this->getTitle()->getFullURL(),
 179+ 'action' => $this->getTitle()->getLocalURL(),
180180 'method' => 'post',
181181 ),
182182 $html
Index: trunk/extensions/LiquidThreads/classes/View.php
@@ -67,7 +67,7 @@
6868
6969 $queryString = wfArrayToCGI( $query );
7070
71 - return $title->getFullUrl( $queryString );
 71+ return $title->getLocalUrl( $queryString );
7272 }
7373
7474 /** Gets an array of (title, query-parameters) for a permalink **/
@@ -154,7 +154,7 @@
155155 static function linkInContextURL( $thread, $contextType = 'page' ) {
156156 list( $title, $query ) = self::linkInContextData( $thread, $contextType );
157157
158 - return $title->getFullURL( $query );
 158+ return $title->getLocalURL( $query );
159159 }
160160
161161 static function diffQuery( $thread, $revision ) {
@@ -265,7 +265,7 @@
266266 function queryReplaceLink( $repls ) {
267267 $query = $this->getReplacedQuery( $repls );
268268
269 - return $this->title->getFullURL( wfArrayToCGI( $vs ) );
 269+ return $this->title->getLocalURL( wfArrayToCGI( $vs ) );
270270 }
271271
272272 function getReplacedQuery( $replacements ) {
@@ -296,7 +296,7 @@
297297 }
298298
299299 function showReplyProtectedNotice( $thread ) {
300 - $log_url = SpecialPage::getTitleFor( 'Log' )->getFullURL(
 300+ $log_url = SpecialPage::getTitleFor( 'Log' )->getLocalURL(
301301 "type=protect&user=&page={$thread->title()->getPrefixedURL()}" );
302302 $this->output->addHTML( '<p>' . wfMsg( 'lqt_protectedfromreply',
303303 '<a href="' . $log_url . '">' . wfMsg( 'lqt_protectedfromreply_link' ) . '</a>' ) );
@@ -476,7 +476,7 @@
477477 if ( !empty($thread) ) {
478478 $redirectTitle->setFragment( '#' . $this->anchorName( $thread ) );
479479 }
480 - $this->output->redirect( $this->title->getFullURL() );
 480+ $this->output->redirect( $this->title->getLocalURL() );
481481 }
482482
483483 }
@@ -585,7 +585,7 @@
586586 $redirectTitle->setFragment( '#' .
587587 $this->anchorName( $newThread ) );
588588 }
589 - $this->output->redirect( $this->title->getFullURL() );
 589+ $this->output->redirect( $this->title->getLocalURL() );
590590 }
591591
592592 $this->output->addHTML( '</div>' );
@@ -688,7 +688,7 @@
689689 if ( $this->output->getRedirect() != '' ) {
690690 $redirectTitle = clone $talkpage->getTitle();
691691 $redirectTitle->setFragment( '#' . $this->anchorName( $thread ) );
692 - $this->output->redirect( $this->title->getFullURL() );
 692+ $this->output->redirect( $this->title->getLocalURL() );
693693 }
694694
695695 }
@@ -753,7 +753,7 @@
754754 if ( $this->output->getRedirect() != '' ) {
755755 $redirectTitle = clone $talkpage->getTitle();
756756 $redirectTitle->setFragment( '#' . $this->anchorName( $thread ) );
757 - $this->output->redirect( $this->title->getFullURL() );
 757+ $this->output->redirect( $this->title->getLocalURL() );
758758 }
759759
760760 }
@@ -766,7 +766,7 @@
767767 global $wgMemc;
768768
769769 if ( $wgMemc->get( $nonce_key ) ) {
770 - $this->output->redirect( $this->article->getTitle()->getFullURL() );
 770+ $this->output->redirect( $this->article->getTitle()->getLocalURL() );
771771 return false;
772772 }
773773 }
@@ -1039,7 +1039,7 @@
10401040 );
10411041
10421042 if ( $this->user->isAllowed( 'delete' ) ) {
1043 - $delete_url = $thread->title()->getFullURL( 'action=delete' );
 1043+ $delete_url = $thread->title()->getLocalURL( 'action=delete' );
10441044 $deleteMsg = $thread->type() == Threads::TYPE_DELETED ? 'lqt_undelete' : 'delete';
10451045
10461046 $commands['delete'] = array(
@@ -1051,7 +1051,7 @@
10521052
10531053 if ( !$thread->isTopmostThread() && $this->user->isAllowed( 'lqt-split' ) ) {
10541054 $splitUrl = SpecialPage::getTitleFor( 'SplitThread',
1055 - $thread->title()->getPrefixedText() )->getFullURL();
 1055+ $thread->title()->getPrefixedText() )->getLocalURL();
10561056 $commands['split'] = array(
10571057 'label' => wfMsgExt( 'lqt-thread-split', 'parseinline' ),
10581058 'href' => $splitUrl,
@@ -1065,7 +1065,7 @@
10661066
10671067 unset( $mergeParams['title'] );
10681068
1069 - $mergeUrl = $this->title->getFullURL( wfArrayToCGI( $mergeParams ) );
 1069+ $mergeUrl = $this->title->getLocalURL( wfArrayToCGI( $mergeParams ) );
10701070 $label = wfMsgExt( 'lqt-thread-merge', 'parseinline' );
10711071
10721072 $commands['merge'] = array(
@@ -1077,7 +1077,7 @@
10781078
10791079 $commands['link'] = array(
10801080 'label' => wfMsgExt( 'lqt_permalink', 'parseinline' ),
1081 - 'href' => $thread->title()->getFullURL(),
 1081+ 'href' => $thread->title()->getLocalURL(),
10821082 'enabled' => true,
10831083 'showlabel' => true,
10841084 'tooltip' => wfMsgExt( 'lqt_permalink', 'parseinline' )
@@ -1111,7 +1111,7 @@
11121112 $srcThread = Threads::withId( $this->request->getVal( 'lqt_merge_from' ) );
11131113 $par = $srcThread->title()->getPrefixedText();
11141114 $mergeTitle = SpecialPage::getTitleFor( 'MergeThread', $par );
1115 - $mergeUrl = $mergeTitle->getFullURL( 'dest=' . $thread->id() );
 1115+ $mergeUrl = $mergeTitle->getLocalURL( 'dest=' . $thread->id() );
11161116 $label = wfMsgExt( 'lqt-thread-merge-to', 'parseinline' );
11171117
11181118 $commands['merge-to'] = array(
@@ -1162,7 +1162,7 @@
11631163 );
11641164
11651165 if ( $this->user->isAllowed( 'move' ) ) {
1166 - $move_href = SpecialPage::getTitleFor( 'MoveThread' )->getFullURL()
 1166+ $move_href = SpecialPage::getTitleFor( 'MoveThread' )->getLocalURL()
11671167 . '/' . $thread->title()->getPrefixedURL();
11681168 $commands['move'] = array(
11691169 'label' => wfMsg( 'lqt-movethread' ),
@@ -1172,7 +1172,7 @@
11731173 }
11741174
11751175 if ( $this->user->isAllowed( 'protect' ) ) {
1176 - $protect_href = $thread->title()->getFullURL( 'action=protect' );
 1176+ $protect_href = $thread->title()->getLocalURL( 'action=protect' );
11771177
11781178 // Check if it's already protected
11791179 if ( !$thread->title()->isProtected() ) {
Index: trunk/extensions/LiquidThreads/classes/Dispatch.php
@@ -9,7 +9,7 @@
1010
1111 if ( $title->getNamespace() == NS_LQT_THREAD + 1 /* talk page */ ) {
1212 // Threads don't have talk pages; redirect to the thread page.
13 - $output->redirect( $title->getSubjectPage()->getFullUrl() );
 13+ $output->redirect( $title->getSubjectPage()->getLocalUrl() );
1414 return false;
1515 }
1616
@@ -17,7 +17,7 @@
1818 $redlink = $request->getCheck( 'redlink' ) &&
1919 $request->getText( 'action' ) == 'edit';
2020 if ( $redlink ) {
21 - $output->redirect( $title->getFullURL() );
 21+ $output->redirect( $title->getLocalURL() );
2222 return false;
2323 }
2424
Index: trunk/extensions/LiquidThreads/pages/ThreadPermalinkView.php
@@ -35,12 +35,12 @@
3636 // Repoint move/delete/history tabs
3737 if ( array_key_exists( 'move', $content_actions ) && $view->thread ) {
3838 $content_actions['move']['href'] =
39 - SpecialPage::getTitleFor( 'MoveThread', $subpage )->getFullURL();
 39+ SpecialPage::getTitleFor( 'MoveThread', $subpage )->getLocalURL();
4040 }
4141
4242 if ( array_key_exists( 'delete', $content_actions ) && $view->thread ) {
4343 $content_actions['delete']['href'] =
44 - $view->thread->title()->getFullURL( 'action=delete' );
 44+ $view->thread->title()->getLocalURL( 'action=delete' );
4545 }
4646
4747 if ( array_key_exists( 'history', $content_actions ) ) {
@@ -85,12 +85,12 @@
8686 $actions =& $links['actions'];
8787 if ( isset( $actions['move'] ) ) {
8888 $actions['move']['href'] =
89 - SpecialPage::getTitleFor( 'MoveThread', $subpage )->getFullURL();
 89+ SpecialPage::getTitleFor( 'MoveThread', $subpage )->getLocalURL();
9090 }
9191
9292 if ( isset( $actions['delete'] ) ) {
9393 $actions['delete']['href'] =
94 - $view->thread->title()->getFullURL( 'action=delete' );
 94+ $view->thread->title()->getLocalURL( 'action=delete' );
9595 }
9696
9797 if ( isset( $views['history'] ) ) {
@@ -121,7 +121,7 @@
122122 $tabs['article'] =
123123 array(
124124 'text' => wfMsg( $articleTitle->getNamespaceKey() ),
125 - 'href' => $articleTitle->getFullURL(),
 125+ 'href' => $articleTitle->getLocalURL(),
126126 'class' => implode( ' ', $articleClasses ),
127127 );
128128
@@ -129,7 +129,7 @@
130130 array(
131131 // talkpage certainly exists since this thread is from it.
132132 'text' => wfMsg( 'talk' ),
133 - 'href' => $talkTitle->getFullURL(),
 133+ 'href' => $talkTitle->getLocalURL(),
134134 'class' => implode( ' ', $talkClasses ),
135135 );
136136
Index: trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php
@@ -89,7 +89,7 @@
9090 if ( $tmp_thread )
9191 NewMessages::markThreadAsUnReadByUser( $tmp_thread, $this->user );
9292 }
93 - $this->output->redirect( $this->title->getFullURL() );
 93+ $this->output->redirect( $this->title->getLocalURL() );
9494 }
9595 } elseif ( $this->methodApplies( 'mark_as_read' ) ) {
9696 $ids = explode( ',', $this->request->getVal( 'lqt_operand' ) );
@@ -104,7 +104,7 @@
105105 }
106106 }
107107 $query = 'lqt_method=undo_mark_as_read&lqt_operand=' . implode( ',', $ids );
108 - $this->output->redirect( $this->title->getFullURL( $query ) );
 108+ $this->output->redirect( $this->title->getLocalURL( $query ) );
109109 }
110110 } elseif ( $this->methodApplies( 'undo_mark_as_read' ) ) {
111111 $ids = explode( ',', $this->request->getVal( 'lqt_operand', '' ) );
Index: trunk/extensions/LiquidThreads/pages/TalkpageView.php
@@ -25,7 +25,7 @@
2626 # Protection against non-SkinTemplate skins
2727 if ( isset( $content_actions['history'] ) ) {
2828 $thisTitle = $view->article->getTitle();
29 - $history_url = $thisTitle->getFullURL( 'lqt_method=talkpage_history' );
 29+ $history_url = $thisTitle->getLocalURL( 'lqt_method=talkpage_history' );
3030 $content_actions['history']['href'] = $history_url;
3131 }
3232 }
@@ -40,7 +40,7 @@
4141
4242 if ( isset( $links['views']['history'] ) ) {
4343 $title = $view->article->getTitle();
44 - $history_url = $title->getFullURL( 'lqt_method=talkpage_history' );
 44+ $history_url = $title->getLocalURL( 'lqt_method=talkpage_history' );
4545 $links['views']['history']['href'] = $history_url;
4646 }
4747 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r79608Follow up r79417...hartman22:04, 4 January 2011
r79922More URL patch work for LQT. Someone who has the time needs to clean this up....hartman23:37, 9 January 2011

Comments

#Comment by Raymond (talk | contribs)   21:41, 3 January 2011

It seems this breaks URLs in e-mail notifications, like this one I got today from Translatewiki:

Hallo Raymond,
dies ist eine Benachrichtigung von translatewiki.net, dass am 3. Januar 2011 um 22:21 Uhr auf der Seite 
„User talk:Raymond“ der neue Diskussionsstrang „Customization of number format“ eröffnet wurde.

Du kannst ihn auf </w/i.php?title=User_talk:Raymond&offset=20110103212144&lqt_mustshow=10058> einsehen.
#Comment by TheDJ (talk | contribs)   13:56, 5 January 2011

This should be fixed now, if you can confirm this on translatewiki, then that would be great.

#Comment by Raymond (talk | contribs)   14:25, 5 January 2011

Works now. Thanks. Setting status back to new

#Comment by TheDJ (talk | contribs)   23:38, 9 January 2011

Should be fixed with r79922

#Comment by He7d3r (talk | contribs)   21:45, 28 June 2011

Could someone replicate these fixes to the version which is in use on Portuguese Wikibooks? I'm still seeing the icons on pages like this

Status & tagging log