Index: branches/REL1_18/phase3/RELEASE-NOTES-1.18 |
— | — | @@ -84,6 +84,8 @@ |
85 | 85 | hooks have been removed. |
86 | 86 | * New hook "Collation::factory" to allow extensions to create custom |
87 | 87 | category collations. |
| 88 | +* (bug 31233) New OutputPage::addJsConfigVars() method to make the output page specific |
| 89 | + mw.config map extendable. |
88 | 90 | |
89 | 91 | === New features in 1.18 === |
90 | 92 | * BREAKING CHANGE: action=watch / action=unwatch now requires a token. |
Index: branches/REL1_18/phase3/includes/SpecialPageFactory.php |
— | — | @@ -444,7 +444,7 @@ |
445 | 445 | wfProfileOut( __METHOD__ ); |
446 | 446 | return $title; |
447 | 447 | } else { |
448 | | - $context->setTitle( $page->getTitle() ); |
| 448 | + $context->setTitle( $page->getTitle( $par ) ); |
449 | 449 | } |
450 | 450 | |
451 | 451 | } elseif ( !$page->isIncludable() ) { |
Property changes on: branches/REL1_18/phase3/includes/SpecialPageFactory.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
452 | 452 | Merged /trunk/phase3/includes/SpecialPageFactory.php:r98235,98374 |
Index: branches/REL1_18/phase3/includes/Defines.php |
— | — | @@ -249,3 +249,4 @@ |
250 | 250 | define( 'PROTO_RELATIVE', '//' ); |
251 | 251 | define( 'PROTO_CURRENT', null ); |
252 | 252 | define( 'PROTO_CANONICAL', 1 ); |
| 253 | +define( 'PROTO_INTERNAL', 2 ); |
Index: branches/REL1_18/phase3/includes/GlobalFunctions.php |
— | — | @@ -433,6 +433,7 @@ |
434 | 434 | * PROTO_RELATIVE: Output a URL starting with // (protocol-relative URL) |
435 | 435 | * PROTO_CURRENT: Output a URL starting with either http:// or https:// , depending on which protocol was used for the current incoming request |
436 | 436 | * PROTO_CANONICAL: For URLs without a domain, like /w/index.php , use $wgCanonicalServer. For protocol-relative URLs, use the protocol of $wgCanonicalServer |
| 437 | + * PROTO_INTERNAL: Like PROTO_CANONICAL, but uses $wgInternalServer instead of $wgCanonicalServer |
437 | 438 | * |
438 | 439 | * @todo this won't work with current-path-relative URLs |
439 | 440 | * like "subdir/foo.html", etc. |
— | — | @@ -442,9 +443,15 @@ |
443 | 444 | * @return string Fully-qualified URL |
444 | 445 | */ |
445 | 446 | function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) { |
446 | | - global $wgServer, $wgCanonicalServer; |
447 | | - $serverUrl = $defaultProto === PROTO_CANONICAL ? $wgCanonicalServer : $wgServer; |
448 | | - |
| 447 | + global $wgServer, $wgCanonicalServer, $wgInternalServer; |
| 448 | + $serverUrl = $wgServer; |
| 449 | + if ( $defaultProto === PROTO_CANONICAL ) { |
| 450 | + $serverUrl = $wgCanonicalServer; |
| 451 | + } |
| 452 | + // Make $wgInternalServer fall back to $wgServer if not set |
| 453 | + if ( $defaultProto === PROTO_INTERNAL && $wgInternalServer !== false ) { |
| 454 | + $serverUrl = $wgInternalServer; |
| 455 | + } |
449 | 456 | if ( $defaultProto === PROTO_CURRENT ) { |
450 | 457 | $defaultProto = WebRequest::detectProtocol() . '://'; |
451 | 458 | } |
— | — | @@ -453,11 +460,11 @@ |
454 | 461 | $bits = wfParseUrl( $serverUrl ); |
455 | 462 | $serverHasProto = $bits && $bits['scheme'] != ''; |
456 | 463 | |
457 | | - if ( $defaultProto === PROTO_CANONICAL ) { |
| 464 | + if ( $defaultProto === PROTO_CANONICAL || $defaultProto === PROTO_INTERNAL ) { |
458 | 465 | if ( $serverHasProto ) { |
459 | 466 | $defaultProto = $bits['scheme'] . '://'; |
460 | 467 | } else { |
461 | | - // $wgCanonicalServer doesn't have a protocol. This really isn't supposed to happen |
| 468 | + // $wgCanonicalServer or $wgInternalServer doesn't have a protocol. This really isn't supposed to happen |
462 | 469 | // Fall back to HTTP in this ridiculous case |
463 | 470 | $defaultProto = PROTO_HTTP; |
464 | 471 | } |
Property changes on: branches/REL1_18/phase3/includes/GlobalFunctions.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
465 | 472 | Merged /trunk/phase3/includes/GlobalFunctions.php:r96437-96438,98235,98374 |
Index: branches/REL1_18/phase3/includes/objectcache/MemcachedClient.php |
— | — | @@ -958,6 +958,12 @@ |
959 | 959 | } else { |
960 | 960 | $this->stats[$cmd] = 1; |
961 | 961 | } |
| 962 | + |
| 963 | + // Memcached doesn't seem to handle very high TTL values very well, |
| 964 | + // so clamp them at 30 days |
| 965 | + if ( $exp > 2592000 ) { |
| 966 | + $exp = 2592000; |
| 967 | + } |
962 | 968 | |
963 | 969 | $flags = 0; |
964 | 970 | |
Index: branches/REL1_18/phase3/includes/OutputPage.php |
— | — | @@ -118,6 +118,7 @@ |
119 | 119 | // @todo FIXME: Next variables probably comes from the resource loader |
120 | 120 | var $mModules = array(), $mModuleScripts = array(), $mModuleStyles = array(), $mModuleMessages = array(); |
121 | 121 | var $mResourceLoader; |
| 122 | + var $mJsConfigVars = array(); |
122 | 123 | |
123 | 124 | /** @todo FIXME: Is this still used ?*/ |
124 | 125 | var $mInlineMsg = array(); |
— | — | @@ -1314,7 +1315,7 @@ |
1315 | 1316 | } |
1316 | 1317 | |
1317 | 1318 | /** |
1318 | | - * Add wikitext with a custom Title object and |
| 1319 | + * Add wikitext with a custom Title object and tidy enabled. |
1319 | 1320 | * |
1320 | 1321 | * @param $text String: wikitext |
1321 | 1322 | * @param $title Title object |
— | — | @@ -2576,11 +2577,29 @@ |
2577 | 2578 | } |
2578 | 2579 | |
2579 | 2580 | /** |
2580 | | - * Get an array containing global JS variables |
| 2581 | + * Add one or more variables to be set in mw.config in JavaScript. |
2581 | 2582 | * |
2582 | | - * Do not add things here which can be evaluated in |
2583 | | - * ResourceLoaderStartupScript - in other words, without state. |
2584 | | - * You will only be adding bloat to the page and causing page caches to |
| 2583 | + * @param $key {String|Array} Key or array of key/value pars. |
| 2584 | + * @param $value {Mixed} Value of the configuration variable. |
| 2585 | + */ |
| 2586 | + public function addJsConfigVars( $keys, $value ) { |
| 2587 | + if ( is_array( $keys ) ) { |
| 2588 | + foreach ( $keys as $key => $value ) { |
| 2589 | + $this->mJsConfigVars[$key] = $value; |
| 2590 | + } |
| 2591 | + return; |
| 2592 | + } |
| 2593 | + |
| 2594 | + $this->mJsConfigVars[$keys] = $value; |
| 2595 | + } |
| 2596 | + |
| 2597 | + |
| 2598 | + /** |
| 2599 | + * Get an array containing the variables to be set in mw.config in JavaScript. |
| 2600 | + * |
| 2601 | + * Do not add things here which can be evaluated in ResourceLoaderStartupScript |
| 2602 | + * - in other words, page-indendent/site-wide variables (without state). |
| 2603 | + * You will only be adding bloat to the html page and causing page caches to |
2585 | 2604 | * have to be purged on configuration changes. |
2586 | 2605 | */ |
2587 | 2606 | protected function getJSVars() { |
— | — | @@ -2623,10 +2642,14 @@ |
2624 | 2643 | $vars['wgIsMainPage'] = true; |
2625 | 2644 | } |
2626 | 2645 | |
2627 | | - // Allow extensions to add their custom variables to the global JS variables |
| 2646 | + // Allow extensions to add their custom variables to the mw.config map. |
| 2647 | + // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not |
| 2648 | + // page-dependant but site-wide (without state). |
| 2649 | + // Alternatively, you may want to use OutputPage->addJsConfigVars() instead. |
2628 | 2650 | wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars ) ); |
2629 | 2651 | |
2630 | | - return $vars; |
| 2652 | + // Merge in variables from addJsConfigVars last |
| 2653 | + return array_merge( $vars, $this->mJsConfigVars ); |
2631 | 2654 | } |
2632 | 2655 | |
2633 | 2656 | /** |
Property changes on: branches/REL1_18/phase3/includes/OutputPage.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
2634 | 2657 | Merged /trunk/phase3/includes/OutputPage.php:r98374 |
Index: branches/REL1_18/phase3/includes/cache/SquidUpdate.php |
— | — | @@ -221,11 +221,6 @@ |
222 | 222 | * @return string |
223 | 223 | */ |
224 | 224 | static function expand( $url ) { |
225 | | - global $wgInternalServer, $wgServer; |
226 | | - $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer; |
227 | | - if( $url !== '' && $url[0] == '/' ) { |
228 | | - return $server . $url; |
229 | | - } |
230 | | - return $url; |
| 225 | + return wfExpandUrl( $url, PROTO_INTERNAL ); |
231 | 226 | } |
232 | 227 | } |
Index: branches/REL1_18/phase3/includes/specials/SpecialProtectedtitles.php |
— | — | @@ -78,10 +78,12 @@ |
79 | 79 | |
80 | 80 | wfProfileIn( __METHOD__ ); |
81 | 81 | |
82 | | - static $skin = null; |
| 82 | + static $skin = null, $infinity = null; |
83 | 83 | |
84 | | - if( is_null( $skin ) ) |
| 84 | + if( is_null( $skin ) ){ |
85 | 85 | $skin = $this->getSkin(); |
| 86 | + $infinity = wfGetDB( DB_SLAVE )->getInfinity(); |
| 87 | + } |
86 | 88 | |
87 | 89 | $title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title ); |
88 | 90 | $link = $skin->link( $title ); |
— | — | @@ -92,12 +94,12 @@ |
93 | 95 | |
94 | 96 | $description_items[] = $protType; |
95 | 97 | |
96 | | - if ( $row->pt_expiry != 'infinity' && strlen($row->pt_expiry) ) { |
97 | | - $expiry = $wgLang->formatExpiry( $row->pt_expiry ); |
| 98 | + $expiry = strlen( $row->pt_expiry ) ? $wgLang->formatExpiry( $row->pt_expiry, TS_MW ) : $infinity; |
| 99 | + if( $expiry != $infinity ) { |
98 | 100 | |
99 | 101 | $expiry_description = wfMsg( 'protect-expiring', $wgLang->timeanddate( $expiry ) , $wgLang->date( $expiry ) , $wgLang->time( $expiry ) ); |
100 | 102 | |
101 | | - $description_items[] = $expiry_description; |
| 103 | + $description_items[] = htmlspecialchars($expiry_description); |
102 | 104 | } |
103 | 105 | |
104 | 106 | wfProfileOut( __METHOD__ ); |
Property changes on: branches/REL1_18/phase3/includes/specials |
___________________________________________________________________ |
Modified: svn:mergeinfo |
105 | 107 | Merged /trunk/phase3/includes/specials:r93726,94199,96437-96438,98235,98374 |
Property changes on: branches/REL1_18/phase3/includes |
___________________________________________________________________ |
Modified: svn:mergeinfo |
106 | 108 | Merged /trunk/phase3/includes:r93726,94199,96437-96438,98235,98374 |
Property changes on: branches/REL1_18/phase3 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
107 | 109 | Merged /trunk/phase3:r93726,94199,96437-96438,96579,98235,98374 |