https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112644
Revision: 112644
Author: reedy
Date: 2012-02-28 21:13:30 +0000 (Tue, 28 Feb 2012)
Log Message:
-----------
MFT r112169, r112170, r112172, r112173, r112179, r112184, r112290, r112313
Modified Paths:
--------------
branches/REL1_19/phase3/RELEASE-NOTES-1.19
branches/REL1_19/phase3/includes/AutoLoader.php
branches/REL1_19/phase3/includes/PathRouter.php
branches/REL1_19/phase3/includes/api/ApiParamInfo.php
branches/REL1_19/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
branches/REL1_19/phase3/resources/Resources.php
branches/REL1_19/phase3/resources/mediawiki/mediawiki.feedback.js
branches/REL1_19/phase3/resources/mediawiki/mediawiki.util.js
branches/REL1_19/phase3/tests/phpunit/includes/PathRouterTest.php
Added Paths:
-----------
branches/REL1_19/phase3/resources/mediawiki/mediawiki.feedback.css
branches/REL1_19/phase3/resources/mediawiki/mediawiki.feedback.spinner.gif
Property Changed:
----------------
branches/REL1_19/phase3/
branches/REL1_19/phase3/includes/
branches/REL1_19/phase3/includes/AutoLoader.php
branches/REL1_19/phase3/includes/api/
Property changes on: branches/REL1_19/phase3
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/JSTesting:100352-107913
/branches/REL1_15/phase3:51646
/branches/REL1_17/phase3:81445,81448
/branches/new-installer/phase3:43664-66004
/branches/sqlite:58211-58321
/branches/wmf/1.18wmf1:97508,111667
/trunk/phase3:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251,111380,111478,111571,111574,111580,111597,111658,111673,111695,111697,111809,111832,111983,112021,112034,112037,112045-112046,112049,112061,112066,112079,112128,112152
+ /branches/JSTesting:100352-107913
/branches/REL1_15/phase3:51646
/branches/REL1_17/phase3:81445,81448
/branches/new-installer/phase3:43664-66004
/branches/sqlite:58211-58321
/branches/wmf/1.18wmf1:97508,111667
/trunk/phase3:111002,111029,111034,111062,111067,111076,111085,111128,111144,111251,111380,111478,111571,111574,111580,111597,111658,111673,111695,111697,111809,111832,111983,112021,112034,112037,112045-112046,112049,112061,112066,112079,112128,112152,112169-112170,112172-112173,112179,112184,112290,112313
Modified: branches/REL1_19/phase3/RELEASE-NOTES-1.19
===================================================================
--- branches/REL1_19/phase3/RELEASE-NOTES-1.19 2012-02-28 21:13:11 UTC (rev
112643)
+++ branches/REL1_19/phase3/RELEASE-NOTES-1.19 2012-02-28 21:13:30 UTC (rev
112644)
@@ -248,6 +248,8 @@
around a bug where not all styles were applied in Internet Explorer
* (bug 28936, bug 5280) Broken or invalid titles can't be removed from
watchlist.* (Bug 33087) Exchange server rejected mail sent by MediaWiki
* (bug 34600) Older skins using useHeadElement=false were broken in 1.18
+* (bug 34604) [mw.config] wgActionPaths should be an object instead of a
numeral
+ array.
=== API changes in 1.19 ===
* Made action=edit less likely to return "unknownerror", by returning the
actual error
Property changes on: branches/REL1_19/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/JSTesting/includes:100352-107913
/branches/REL1_15/phase3/includes:51646
/branches/new-installer/phase3/includes:43664-66004
/branches/sqlite/includes:58211-58321
/branches/wmf/1.18wmf1/includes:97508,111667
/branches/wmf-deployment/includes:53381
/trunk/phase3/includes:111029,111034,111067,111085,111128,111144,111251,111380,111571,111574,111597,111658,111673,111695,111697,111809,111832,111983,112021,112034,112037,112045-112046,112049,112061,112066,112079,112128,112152
+ /branches/JSTesting/includes:100352-107913
/branches/REL1_15/phase3/includes:51646
/branches/new-installer/phase3/includes:43664-66004
/branches/sqlite/includes:58211-58321
/branches/wmf/1.18wmf1/includes:97508,111667
/branches/wmf-deployment/includes:53381
/trunk/phase3/includes:111029,111034,111067,111085,111128,111144,111251,111380,111571,111574,111597,111658,111673,111695,111697,111809,111832,111983,112021,112034,112037,112045-112046,112049,112061,112066,112079,112128,112152,112184,112290,112313
Modified: branches/REL1_19/phase3/includes/AutoLoader.php
===================================================================
--- branches/REL1_19/phase3/includes/AutoLoader.php 2012-02-28 21:13:11 UTC
(rev 112643)
+++ branches/REL1_19/phase3/includes/AutoLoader.php 2012-02-28 21:13:30 UTC
(rev 112644)
@@ -162,6 +162,7 @@
'Pager' => 'includes/Pager.php',
'PasswordError' => 'includes/User.php',
'PathRouter' => 'includes/PathRouter.php',
+ 'PathRouterPatternReplacer' => 'includes/PathRouter.php',
'PermissionsError' => 'includes/Exception.php',
'PhpHttpRequest' => 'includes/HttpFunctions.php',
'PoolCounter' => 'includes/PoolCounter.php',
Property changes on: branches/REL1_19/phase3/includes/AutoLoader.php
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/FileBackend/phase3/includes/AutoLoader.php:99972-106750
/branches/JSTesting/includes/AutoLoader.php:100352-107913
/branches/REL1_15/phase3/includes/AutoLoader.php:51646
/branches/REL1_17/phase3/includes/AutoLoader.php:81448
/branches/new-installer/phase3/includes/AutoLoader.php:43664-66004
/branches/sqlite/includes/AutoLoader.php:58211-58321
/branches/uploadwizard/phase3/includes/AutoLoader.php:73550-75905
/branches/wmf-deployment/includes/AutoLoader.php:53381
/trunk/phase3/includes/AutoLoader.php:111029,111034,111067,111085,111128,111144
+ /branches/FileBackend/phase3/includes/AutoLoader.php:99972-106750
/branches/JSTesting/includes/AutoLoader.php:100352-107913
/branches/REL1_15/phase3/includes/AutoLoader.php:51646
/branches/REL1_17/phase3/includes/AutoLoader.php:81448
/branches/new-installer/phase3/includes/AutoLoader.php:43664-66004
/branches/sqlite/includes/AutoLoader.php:58211-58321
/branches/uploadwizard/phase3/includes/AutoLoader.php:73550-75905
/branches/wmf-deployment/includes/AutoLoader.php:53381
/trunk/phase3/includes/AutoLoader.php:111029,111034,111067,111085,111128,111144,112313
Modified: branches/REL1_19/phase3/includes/PathRouter.php
===================================================================
--- branches/REL1_19/phase3/includes/PathRouter.php 2012-02-28 21:13:11 UTC
(rev 112643)
+++ branches/REL1_19/phase3/includes/PathRouter.php 2012-02-28 21:13:30 UTC
(rev 112644)
@@ -278,20 +278,14 @@
} elseif ( isset( $paramData['pattern'] ) ) {
// For patterns we have to make value
replacements on the string
$value = $paramData['pattern'];
- // For each $# match replace any $#
within the value
- foreach ( $m as $matchKey =>
$matchValue ) {
- if ( preg_match( '/^par\d+$/u',
$matchKey ) ) {
- $n = intval( substr(
$matchKey, 3 ) );
- $value = str_replace(
'$' . $n, rawurldecode( $matchValue ), $value );
- }
- }
- // If a key was set replace any $key
within the value
+ $replacer = new
PathRouterPatternReplacer;
+ $replacer->params = $m;
if ( isset( $pattern->key ) ) {
- $value = str_replace( '$key',
$pattern->key, $value );
+ $replacer->key = $pattern->key;
}
- if ( preg_match( '/\$(\d+|key)/u',
$value ) ) {
- // Still contains $# or $key
patterns after replacement
- // Seams like we don't have all
the data, abort
+ $value = $replacer->replace( $value );
+ if ( $value === false ) {
+ // Pattern required data that
wasn't available, abort
return null;
}
}
@@ -317,3 +311,41 @@
}
}
+
+class PathRouterPatternReplacer {
+
+ public $key, $params, $error;
+
+ /**
+ * Replace keys inside path router patterns with text.
+ * We do this inside of a replacement callback because after
replacement we can't tell the
+ * difference between a $1 that was not replaced and a $1 that was part
of
+ * the content a $1 was replaced with.
+ */
+ public function replace( $value ) {
+ $this->error = false;
+ $value = preg_replace_callback( '/\$(\d+|key)/u', array( $this,
'callback' ), $value );
+ if ( $this->error ) {
+ return false;
+ }
+ return $value;
+ }
+
+ protected function callback( $m ) {
+ if ( $m[1] == "key" ) {
+ if ( is_null( $this->key ) ) {
+ $this->error = true;
+ return '';
+ }
+ return $this->key;
+ } else {
+ $d = $m[1];
+ if ( !isset( $this->params["par$d"] ) ) {
+ $this->error = true;
+ return '';
+ }
+ return rawurldecode( $this->params["par$d"] );
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: branches/REL1_19/phase3/includes/api
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/JSTesting/includes/api:100352-107913
/branches/REL1_15/phase3/includes/api:51646
/branches/REL1_16/phase3/includes/api:63621-63636,69357
/branches/sqlite/includes/api:58211-58321
/branches/wmf/1.16wmf4/includes/api:69521
/branches/wmf/1.18wmf1/includes/api:97789,111667
/branches/wmf-deployment/includes/api:53381,59952
/trunk/phase3/includes/api:111673
+ /branches/JSTesting/includes/api:100352-107913
/branches/REL1_15/phase3/includes/api:51646
/branches/REL1_16/phase3/includes/api:63621-63636,69357
/branches/sqlite/includes/api:58211-58321
/branches/wmf/1.16wmf4/includes/api:69521
/branches/wmf/1.18wmf1/includes/api:97789,111667
/branches/wmf-deployment/includes/api:53381,59952
/trunk/phase3/includes/api:111673,112290,112313
Modified: branches/REL1_19/phase3/includes/api/ApiParamInfo.php
===================================================================
--- branches/REL1_19/phase3/includes/api/ApiParamInfo.php 2012-02-28
21:13:11 UTC (rev 112643)
+++ branches/REL1_19/phase3/includes/api/ApiParamInfo.php 2012-02-28
21:13:30 UTC (rev 112644)
@@ -147,6 +147,9 @@
$examples = $obj->getExamples();
$retval['allexamples'] = array();
if ( $examples !== false ) {
+ if ( is_string( $examples ) ) {
+ $examples = array( $examples );
+ }
foreach( $examples as $k => $v ) {
if ( strlen( $retval['examples'] ) ) {
$retval['examples'] .= ' ';
Modified:
branches/REL1_19/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
===================================================================
---
branches/REL1_19/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
2012-02-28 21:13:11 UTC (rev 112643)
+++
branches/REL1_19/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
2012-02-28 21:13:30 UTC (rev 112644)
@@ -68,7 +68,9 @@
'wgScriptExtension' => $wgScriptExtension,
'wgScript' => $wgScript,
'wgVariantArticlePath' => $wgVariantArticlePath,
- 'wgActionPaths' => $wgActionPaths,
+ // Force object to avoid "empty" associative array from
+ // becoming [] instead of {} in JS (bug 34604)
+ 'wgActionPaths' => (object)$wgActionPaths,
'wgServer' => $wgServer,
'wgUserLanguage' => $context->getLanguage(),
'wgContentLanguage' => $wgContLang->getCode(),
Modified: branches/REL1_19/phase3/resources/Resources.php
===================================================================
--- branches/REL1_19/phase3/resources/Resources.php 2012-02-28 21:13:11 UTC
(rev 112643)
+++ branches/REL1_19/phase3/resources/Resources.php 2012-02-28 21:13:30 UTC
(rev 112644)
@@ -554,6 +554,7 @@
),
'mediawiki.feedback' => array(
'scripts' => 'resources/mediawiki/mediawiki.feedback.js',
+ 'styles' => 'resources/mediawiki/mediawiki.feedback.css',
'dependencies' => array(
'mediawiki.api.edit',
'mediawiki.Title',
Copied: branches/REL1_19/phase3/resources/mediawiki/mediawiki.feedback.css
(from rev 112173, trunk/phase3/resources/mediawiki/mediawiki.feedback.css)
===================================================================
--- branches/REL1_19/phase3/resources/mediawiki/mediawiki.feedback.css
(rev 0)
+++ branches/REL1_19/phase3/resources/mediawiki/mediawiki.feedback.css
2012-02-28 21:13:30 UTC (rev 112644)
@@ -0,0 +1,9 @@
+.feedback-spinner {
+ display: inline-block;
+ zoom: 1;
+ *display: inline; /* IE7 and below */
+ /* @embed */
+ background: url(mediawiki.feedback.spinner.gif);
+ width: 18px;
+ height: 18px;
+}
Modified: branches/REL1_19/phase3/resources/mediawiki/mediawiki.feedback.js
===================================================================
--- branches/REL1_19/phase3/resources/mediawiki/mediawiki.feedback.js
2012-02-28 21:13:11 UTC (rev 112643)
+++ branches/REL1_19/phase3/resources/mediawiki/mediawiki.feedback.js
2012-02-28 21:13:30 UTC (rev 112644)
@@ -106,7 +106,7 @@
$( '<div class="feedback-mode
feedback-submitting" style="text-align:center;margin:3em 0;"></div>' ).append(
mw.msg( 'feedback-adding' ),
$( '<br/>' ),
- $( '<img
src="http://upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />' )
+ $( '<span
class="feedback-spinner"></span>' )
),
$( '<div class="feedback-mode
feedback-thanks" style="text-align:center;margin:1em"></div>' ).msg(
'feedback-thanks',
_this.title.getNameText(), $feedbackPageLink.clone()
Copied:
branches/REL1_19/phase3/resources/mediawiki/mediawiki.feedback.spinner.gif
(from rev 112173,
trunk/phase3/resources/mediawiki/mediawiki.feedback.spinner.gif)
===================================================================
(Binary files differ)
Modified: branches/REL1_19/phase3/resources/mediawiki/mediawiki.util.js
===================================================================
--- branches/REL1_19/phase3/resources/mediawiki/mediawiki.util.js
2012-02-28 21:13:11 UTC (rev 112643)
+++ branches/REL1_19/phase3/resources/mediawiki/mediawiki.util.js
2012-02-28 21:13:30 UTC (rev 112644)
@@ -2,7 +2,7 @@
* Implements mediaWiki.util library
*/
( function ( $, mw ) {
-"use strict";
+ "use strict";
// Local cache and alias
var util = {
@@ -121,19 +121,19 @@
* @param str string String to be encoded
*/
wikiUrlencode: function ( str ) {
- return this.rawurlencode( str )
+ return util.rawurlencode( str )
.replace( /%20/g, '_' ).replace( /%3A/g, ':'
).replace( /%2F/g, '/' );
},
/**
* Get the link to a page name (relative to wgServer)
*
- * @param str string Page name to get the link for.
- * @return string Location for a page with name of 'str' or
boolean false on error.
+ * @param str String: Page name to get the link for.
+ * @return String: Location for a page with name of 'str' or
boolean false on error.
*/
wikiGetlink: function ( str ) {
return mw.config.get( 'wgArticlePath' ).replace( '$1',
- this.wikiUrlencode( str || mw.config.get(
'wgPageName' ) ) );
+ util.wikiUrlencode( typeof str === 'string' ?
str : mw.config.get( 'wgPageName' ) ) );
},
/**
@@ -384,7 +384,7 @@
$link.attr( 'title', tooltip );
}
if ( accesskey && tooltip ) {
- this.updateTooltipAccessKeys( $link );
+ util.updateTooltipAccessKeys( $link );
}
// Where to put our node ?
Modified: branches/REL1_19/phase3/tests/phpunit/includes/PathRouterTest.php
===================================================================
--- branches/REL1_19/phase3/tests/phpunit/includes/PathRouterTest.php
2012-02-28 21:13:11 UTC (rev 112643)
+++ branches/REL1_19/phase3/tests/phpunit/includes/PathRouterTest.php
2012-02-28 21:13:30 UTC (rev 112644)
@@ -125,6 +125,16 @@
}
/**
+ * Test to ensure that matches are not made if a parameter expects
nonexistent input
+ */
+ public function testFail() {
+ $router = new PathRouter;
+ $router->add( "/wiki/$1", array( 'title' => "$1$2" ) );
+ $matches = $router->parse( "/wiki/A" );
+ $this->assertEquals( array(), $matches );
+ }
+
+ /**
* Test to ensure weight of paths is handled correctly
*/
public function testWeight() {
@@ -172,12 +182,30 @@
$this->assertEquals( $matches, array( 'title' => "Title_With
Space" ) );
}
+ public function dataRegexpChars() {
+ return array(
+ array( "$" ),
+ array( "$1" ),
+ array( "\\" ),
+ array( "\\$1" ),
+ );
+ }
+
/**
+ * Make sure the router doesn't break on special characters like $ used
in regexp replacements
+ * @dataProvider dataRegexpChars
+ */
+ public function testRegexpChars( $char ) {
+ $matches = $this->basicRouter->parse( "/wiki/$char" );
+ $this->assertEquals( $matches, array( 'title' => "$char" ) );
+ }
+
+ /**
* Make sure the router handles characters like +&() properly
*/
public function testCharacters() {
- $matches = $this->basicRouter->parse( "/wiki/Plus+And&Stuff()"
);
- $this->assertEquals( $matches, array( 'title' =>
"Plus+And&Stuff()" ) );
+ $matches = $this->basicRouter->parse(
"/wiki/Plus+And&Dollar\\Stuff();[]{}*" );
+ $this->assertEquals( $matches, array( 'title' =>
"Plus+And&Dollar\\Stuff();[]{}*" ) );
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs