r44406 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44405‎ | r44406 | r44407 >
Date:15:56, 10 December 2008
Author:vyznev
Status:resolved (Comments)
Tags:
Comment:
(bug 4253, bug 16586) Don't repeat titles of new pages in URLs in the RC->IRC feed, use the shorter and more useful revision ID instead.
Also simplify URL construction: old code used to call Title::getInternalURL() to build the URLs and then undo most of the work with preg_replace().
(TODO: Maybe consider introducing new global $wgIRCLineURLPrefix to optionally override the $wgInternalServer.$wgScript prefix?)
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/RecentChange.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RecentChange.php
@@ -589,7 +589,8 @@
590590 }
591591
592592 protected function getIRCLine() {
593 - global $wgUseRCPatrol, $wgUseNPPatrol, $wgRC2UDPInterwikiPrefix, $wgLocalInterwiki;
 593+ global $wgUseRCPatrol, $wgUseNPPatrol, $wgRC2UDPInterwikiPrefix, $wgLocalInterwiki,
 594+ $wgInternalServer, $wgScript;
594595
595596 // FIXME: Would be good to replace these 2 extract() calls with something more explicit
596597 // e.g. list ($rc_type, $rc_id) = array_values ($this->mAttribs); [or something like that]
@@ -604,19 +605,21 @@
605606 $title = $titleObj->getPrefixedText();
606607 $title = self::cleanupForIRC( $title );
607608
608 - // FIXME: *HACK* these should be getFullURL(), hacked for SSL madness --brion 2005-12-26
 609+ // XXX: This used to call Title::getInternalURL() and then strip out the title, but that's
 610+ // a lot of complex code just to prepend two globals to a query string. Simplified.
609611 if( $rc_type == RC_LOG ) {
610612 $url = '';
611 - } elseif( $rc_new && ($wgUseRCPatrol || $wgUseNPPatrol) ) {
612 - $url = $titleObj->getInternalURL("rcid=$rc_id");
613 - } else if( $rc_new ) {
614 - $url = $titleObj->getInternalURL();
615 - } else if( $wgUseRCPatrol ) {
616 - $url = $titleObj->getInternalURL("diff=$rc_this_oldid&oldid=$rc_last_oldid&rcid=$rc_id");
617 - $url = preg_replace('/title=[^&]*&/', '', $url);
618613 } else {
619 - $url = $titleObj->getInternalURL("diff=$rc_this_oldid&oldid=$rc_last_oldid");
620 - $url = preg_replace('/title=[^&]*&/', '', $url);
 614+ // XXX: *HACK* this should use $wgServer, hacked for SSL madness --brion 2005-12-26
 615+ $url = $wgInternalServer . $wgScript;
 616+ if( $rc_type == RC_NEW ) {
 617+ $url .= "?oldid=$rc_this_oldid";
 618+ } else {
 619+ $url .= "?diff=$rc_this_oldid&oldid=$rc_last_oldid";
 620+ }
 621+ if( $wgUseRCPatrol || ($rc_type == RC_NEW && $wgUseNPPatrol) ) {
 622+ $url .= "&rcid=$rc_id";
 623+ }
621624 }
622625
623626 if( isset( $oldSize ) && isset( $newSize ) ) {
Index: trunk/phase3/RELEASE-NOTES
@@ -394,6 +394,8 @@
395395 * (bug 14268) SVG image sizes now extracted with proper XML parser
396396 * (bug 14365) RepoGroup::findFiles() no longer crashes if passed an invalid
397397 title via the API
 398+* (bug 4253, bug 16586) Revision ID is now given instead of title in URLs for
 399+ new pages in the recent changes IRC feed
398400
399401 === API changes in 1.14 ===
400402

Follow-up revisions

RevisionCommit summaryAuthorDate
r44412Seems r44406 would've broken the RC feed on secure.wikimedia org: fix by intr...vyznev17:03, 10 December 2008
r44414revert r44412 and part of r44406: keep the improved new page URLs, but use th...vyznev18:41, 10 December 2008
r94995Per CR on r44412 and my promise in the commit summary of r94990, stop abusing...catrope11:23, 19 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r42695(bug 4253) - recentchanges IRC:...mrzman22:41, 27 October 2008

Comments

#Comment by Ilmari Karonen (talk | contribs)   17:07, 10 December 2008

ialex pointed out on IRC that this would've broken the RC feed on secure.wikimedia.org. Workaround in r44412, still needs an update to Wikimedia config files.

Status & tagging log