From: Ilmari Karonen Date: Wed, 10 Dec 2008 15:56:02 +0000 (+0000) Subject: (bug 4253, bug 16586) Don't repeat titles of new pages in URLs in the RC->IRC feed... X-Git-Tag: 1.31.0-rc.0~44065 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=dbf477d5cc4e39a7ac0193568014af7fc16e148f;p=lhc%2Fweb%2Fwiklou.git (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?) --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4e8952c576..8e4589e08d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -394,6 +394,8 @@ The following extensions are migrated into MediaWiki 1.14: * (bug 14268) SVG image sizes now extracted with proper XML parser * (bug 14365) RepoGroup::findFiles() no longer crashes if passed an invalid title via the API +* (bug 4253, bug 16586) Revision ID is now given instead of title in URLs for + new pages in the recent changes IRC feed === API changes in 1.14 === diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 10bc318a9c..10834bacbf 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -589,7 +589,8 @@ class RecentChange } protected function getIRCLine() { - global $wgUseRCPatrol, $wgUseNPPatrol, $wgRC2UDPInterwikiPrefix, $wgLocalInterwiki; + global $wgUseRCPatrol, $wgUseNPPatrol, $wgRC2UDPInterwikiPrefix, $wgLocalInterwiki, + $wgInternalServer, $wgScript; // FIXME: Would be good to replace these 2 extract() calls with something more explicit // e.g. list ($rc_type, $rc_id) = array_values ($this->mAttribs); [or something like that] @@ -604,19 +605,21 @@ class RecentChange $title = $titleObj->getPrefixedText(); $title = self::cleanupForIRC( $title ); - // FIXME: *HACK* these should be getFullURL(), hacked for SSL madness --brion 2005-12-26 + // XXX: This used to call Title::getInternalURL() and then strip out the title, but that's + // a lot of complex code just to prepend two globals to a query string. Simplified. if( $rc_type == RC_LOG ) { $url = ''; - } elseif( $rc_new && ($wgUseRCPatrol || $wgUseNPPatrol) ) { - $url = $titleObj->getInternalURL("rcid=$rc_id"); - } else if( $rc_new ) { - $url = $titleObj->getInternalURL(); - } else if( $wgUseRCPatrol ) { - $url = $titleObj->getInternalURL("diff=$rc_this_oldid&oldid=$rc_last_oldid&rcid=$rc_id"); - $url = preg_replace('/title=[^&]*&/', '', $url); } else { - $url = $titleObj->getInternalURL("diff=$rc_this_oldid&oldid=$rc_last_oldid"); - $url = preg_replace('/title=[^&]*&/', '', $url); + // XXX: *HACK* this should use $wgServer, hacked for SSL madness --brion 2005-12-26 + $url = $wgInternalServer . $wgScript; + if( $rc_type == RC_NEW ) { + $url .= "?oldid=$rc_this_oldid"; + } else { + $url .= "?diff=$rc_this_oldid&oldid=$rc_last_oldid"; + } + if( $wgUseRCPatrol || ($rc_type == RC_NEW && $wgUseNPPatrol) ) { + $url .= "&rcid=$rc_id"; + } } if( isset( $oldSize ) && isset( $newSize ) ) {