r38837 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38836‎ | r38837 | r38838 >
Date:04:02, 8 August 2008
Author:tstarling
Status:old
Tags:
Comment:
Backported the following:
* r37999: (bug 14904) double redirect fixer fragment bug
* r38111: __STATICREDIRECT__
* r38751: (bug 15035) reverted English linkTrail
* r38833: (bug 14944) PHP 5.2.6 escapeshellcmd bug

Rearranged RELEASE-NOTES in preparation for a 1.13.0rc2 release.
Modified paths:
  • /branches/REL1_13/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_13/phase3/includes/DoubleRedirectJob.php (modified) (history)
  • /branches/REL1_13/phase3/includes/MagicWord.php (modified) (history)
  • /branches/REL1_13/phase3/includes/Setup.php (modified) (history)
  • /branches/REL1_13/phase3/includes/Title.php (modified) (history)
  • /branches/REL1_13/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: branches/REL1_13/phase3/includes/Setup.php
@@ -114,6 +114,15 @@
115115 }
116116 }
117117
 118+/**
 119+ * Workaround for http://bugs.php.net/bug.php?id=45132
 120+ * escapeshellarg() destroys non-ASCII characters if LANG is not a UTF-8 locale
 121+ */
 122+if ( version_compare( PHP_VERSION, '5.2.6', '>=' ) ) {
 123+ putenv( 'LC_CTYPE=en_US.UTF-8' );
 124+ setlocale( LC_CTYPE, 'en_US.UTF-8' );
 125+}
 126+
118127 if ( !class_exists( 'AutoLoader' ) ) {
119128 require_once( "$IP/includes/AutoLoader.php" );
120129 }
Index: branches/REL1_13/phase3/includes/DoubleRedirectJob.php
@@ -66,6 +66,13 @@
6767 return true;
6868 }
6969
 70+ # Check for a suppression tag (used e.g. in periodically archived discussions)
 71+ $mw = MagicWord::get( 'staticredirect' );
 72+ if ( $mw->match( $text ) ) {
 73+ wfDebug( __METHOD__.": skipping: suppressed with __STATICREDIRECT__\n" );
 74+ return true;
 75+ }
 76+
7077 # Find the current final destination
7178 $newTitle = self::getFinalDestination( $this->redirTitle );
7279 if ( !$newTitle ) {
@@ -78,11 +85,15 @@
7986 wfDebug( __METHOD__.": skipping, already good\n" );
8087 }
8188
 89+ # Preserve fragment (bug 14904)
 90+ $newTitle = Title::makeTitle( $newTitle->getNamespace(), $newTitle->getDBkey(),
 91+ $currentDest->getFragment() );
 92+
8293 # Fix the text
8394 # Remember that redirect pages can have categories, templates, etc.,
8495 # so the regex has to be fairly general
8596 $newText = preg_replace( '/ \[ \[ [^\]]* \] \] /x',
86 - '[[' . $newTitle->getPrefixedText() . ']]',
 97+ '[[' . $newTitle->getFullText() . ']]',
8798 $text, 1 );
8899
89100 if ( $newText === $text ) {
Index: branches/REL1_13/phase3/includes/MagicWord.php
@@ -153,6 +153,7 @@
154154 'noeditsection',
155155 'newsectionlink',
156156 'hiddencat',
 157+ 'staticredirect',
157158 );
158159
159160
Index: branches/REL1_13/phase3/includes/Title.php
@@ -250,12 +250,13 @@
251251 *
252252 * @param int $ns the namespace of the article
253253 * @param string $title the unprefixed database key form
 254+ * @param string $fragment The link fragment (after the "#")
254255 * @return Title the new object
255256 */
256 - public static function &makeTitle( $ns, $title ) {
 257+ public static function &makeTitle( $ns, $title, $fragment = '' ) {
257258 $t = new Title();
258259 $t->mInterwiki = '';
259 - $t->mFragment = '';
 260+ $t->mFragment = $fragment;
260261 $t->mNamespace = $ns = intval( $ns );
261262 $t->mDbkeyform = str_replace( ' ', '_', $title );
262263 $t->mArticleID = ( $ns >= 0 ) ? -1 : 0;
@@ -271,11 +272,12 @@
272273 *
273274 * @param int $ns the namespace of the article
274275 * @param string $title the database key form
 276+ * @param string $fragment The link fragment (after the "#")
275277 * @return Title the new object, or NULL on an error
276278 */
277 - public static function makeTitleSafe( $ns, $title ) {
 279+ public static function makeTitleSafe( $ns, $title, $fragment = '' ) {
278280 $t = new Title();
279 - $t->mDbkeyform = Title::makeName( $ns, $title );
 281+ $t->mDbkeyform = Title::makeName( $ns, $title, $fragment );
280282 if( $t->secureAndSplit() ) {
281283 return $t;
282284 } else {
@@ -391,13 +393,18 @@
392394 * Make a prefixed DB key from a DB key and a namespace index
393395 * @param int $ns numerical representation of the namespace
394396 * @param string $title the DB key form the title
 397+ * @param string $fragment The link fragment (after the "#")
395398 * @return string the prefixed form of the title
396399 */
397 - public static function makeName( $ns, $title ) {
 400+ public static function makeName( $ns, $title, $fragment = '' ) {
398401 global $wgContLang;
399402
400 - $n = $wgContLang->getNsText( $ns );
401 - return $n == '' ? $title : "$n:$title";
 403+ $namespace = $wgContLang->getNsText( $ns );
 404+ $name = $namespace == '' ? $title : "$namespace:$title";
 405+ if ( strval( $fragment ) != '' ) {
 406+ $name .= '#' . $fragment;
 407+ }
 408+ return $name;
402409 }
403410
404411 /**
Index: branches/REL1_13/phase3/languages/messages/MessagesEn.php
@@ -340,6 +340,7 @@
341341 'hiddencat' => array( 1, '__HIDDENCAT__' ),
342342 'pagesincategory' => array( 1, 'PAGESINCATEGORY', 'PAGESINCAT' ),
343343 'pagesize' => array( 1, 'PAGESIZE' ),
 344+ 'staticredirect' => array( 1, '__STATICREDIRECT__' ),
344345 );
345346
346347 /**
@@ -440,7 +441,7 @@
441442 * Regular expression matching the "link trail", e.g. "ed" in [[Toast]]ed, as
442443 * the first group, and the remainder of the string as the second group.
443444 */
444 -$linkTrail = '/^(\p{L&}+)(.*)$/usD';
 445+$linkTrail = '/^([a-z]+)(.*)$/sD';
445446
446447 /**
447448 * List of filenames for some ui images that can be overridden per language
Index: branches/REL1_13/phase3/RELEASE-NOTES
@@ -3,7 +3,7 @@
44 Security reminder: MediaWiki does not require PHP's register_globals
55 setting since version 1.2.0. If you have it on, turn it *off* if you can.
66
7 -== MediaWiki 1.13.0rc1 ==
 7+== MediaWiki 1.13.0rc2 ==
88
99 This is a release candidate of the Summer 2008 quarterly snapshot release
1010 of MediaWiki.
@@ -19,6 +19,29 @@
2020 Those wishing to use the latest code instead of a branch release can obtain
2121 it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
2222
 23+== Changes since 1.13.0rc1 ==
 24+
 25+* $wgForwardSearchUrl has been removed entirely. Documented setting since 1.4
 26+ has been $wgSearchForwardUrl.
 27+* (bug 14907) DatabasePostgres::fieldType now defined.
 28+* (bug 14966) Fix SearchEngineDummy class for silently non-functional search
 29+ on Sqlite instead of horribly fatal error breaky one.
 30+* (bug 14987) Only fix double redirects on page move when the checkbox is
 31+ checked
 32+* (bug 13376) Use $wgPasswordSender, not $wgEmergencyContact, as return
 33+ address for page update notification mails.
 34+* API: Registration time of users registered before the DB field was created is now
 35+ shown as empty instead of the current time.
 36+* (bug 14904): fragments were lost when redirects were fixed.
 37+* Added magic word __STATICREDIRECT__ to suppress the redirect fixer
 38+* (bug 15035) Revert English linkTrail to /^([a-z]+)(.*)$/sD, as it was before
 39+ r36253. Multiple reports of breakage due to old (pre-5.0) PCRE libraries,
 40+ both bundled with PHP and packaged with distros such as RHEL.
 41+* (bug 14944) Shell invocation of external programs such as ImageMagick convert
 42+ was broken in PHP 5.2.6, if the server had a non-UTF-8 locale.
 43+
 44+== Changes since 1.12 ==
 45+
2346 === Configuration changes in 1.13 ===
2447
2548 * New option $wgFeed can be set false to turn off syndication feeds
@@ -71,8 +94,6 @@
7295 creating new directories.
7396 * (bug 14843) $wgCookiePrefix can be set by LocalSettings now, false defaults
7497 current behavior.
75 -* $wgForwardSearchUrl has been removed entirely. Documented setting since 1.4
76 - has been $wgSearchForwardUrl.
7798
7899 === New features in 1.13 ===
79100
@@ -455,13 +476,6 @@
456477 * (bug 12568) configuration script now produce valid XHTML.
457478 * The accesskey to edit a page is now disabled when editing the page, to pre-
458479 vent conflicts with Safari shortcuts.
459 -* (bug 14907) DatabasePostgres::fieldType now defined.
460 -* (bug 14966) Fix SearchEngineDummy class for silently non-functional search
461 - on Sqlite instead of horribly fatal error breaky one.
462 -* (bug 14987) Only fix double redirects on page move when the checkbox is
463 - checked
464 -* (bug 13376) Use $wgPasswordSender, not $wgEmergencyContact, as return
465 - address for page update notification mails.
466480
467481 === API changes in 1.13 ===
468482
@@ -557,8 +571,6 @@
558572 * Added flag "top" to list=usercontribs if the user is the last contributor to
559573 the page
560574 * list=exturlusage in "list all links" mode can now filter by protocol
561 -* Registration time of users registered before the DB field was created is now
562 - shown as empty instead of the current time.
563575
564576 === Languages updated in 1.13 ===
565577

Follow-up revisions

RevisionCommit summaryAuthorDate
r38869Don't limit setlocale() hack to PHP 5.2.6, as per comment on bug 14944.tstarling09:37, 8 August 2008
r38913Update per r38837mfarag16:12, 8 August 2008
r41379Proposed fix for bug 14944, specifically the reports that some servers do not...tstarling10:19, 29 September 2008

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r37999* Fix bug 14904: fragments lost when redirects are fixed....tstarling16:25, 24 July 2008
r38111Magic word __STATICREDIRECT__ to suppress the redirect fixer. For periodicall...tstarling21:49, 27 July 2008
r38751(Bug 15035) Revert linkTrail to /^([a-z]+)(.*)$/sD, as it was before r36253. ...tstarling04:32, 7 August 2008
r38833Workaround for PHP 5.2.6 escapeshellcmd()/escapeshellarg() bugtstarling03:32, 8 August 2008

Status & tagging log