r99980 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99979‎ | r99980 | r99981 >
Date:22:13, 16 October 2011
Author:reedy
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/REL1_18/phase3 (modified) (history)
  • /branches/REL1_18/phase3/RELEASE-NOTES-1.18 (modified) (history)
  • /branches/REL1_18/phase3/includes (modified) (history)
  • /branches/REL1_18/phase3/includes/Defines.php (modified) (history)
  • /branches/REL1_18/phase3/includes/GlobalFunctions.php (modified) (history)
  • /branches/REL1_18/phase3/includes/OutputPage.php (modified) (history)
  • /branches/REL1_18/phase3/includes/SpecialPageFactory.php (modified) (history)
  • /branches/REL1_18/phase3/includes/cache/SquidUpdate.php (modified) (history)
  • /branches/REL1_18/phase3/includes/objectcache/MemcachedClient.php (modified) (history)
  • /branches/REL1_18/phase3/includes/specials (modified) (history)
  • /branches/REL1_18/phase3/includes/specials/SpecialProtectedtitles.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/RELEASE-NOTES-1.18
@@ -84,6 +84,8 @@
8585 hooks have been removed.
8686 * New hook "Collation::factory" to allow extensions to create custom
8787 category collations.
 88+* (bug 31233) New OutputPage::addJsConfigVars() method to make the output page specific
 89+ mw.config map extendable.
8890
8991 === New features in 1.18 ===
9092 * BREAKING CHANGE: action=watch / action=unwatch now requires a token.
Index: branches/REL1_18/phase3/includes/SpecialPageFactory.php
@@ -444,7 +444,7 @@
445445 wfProfileOut( __METHOD__ );
446446 return $title;
447447 } else {
448 - $context->setTitle( $page->getTitle() );
 448+ $context->setTitle( $page->getTitle( $par ) );
449449 }
450450
451451 } elseif ( !$page->isIncludable() ) {
Property changes on: branches/REL1_18/phase3/includes/SpecialPageFactory.php
___________________________________________________________________
Modified: svn:mergeinfo
452452 Merged /trunk/phase3/includes/SpecialPageFactory.php:r98235,98374
Index: branches/REL1_18/phase3/includes/Defines.php
@@ -249,3 +249,4 @@
250250 define( 'PROTO_RELATIVE', '//' );
251251 define( 'PROTO_CURRENT', null );
252252 define( 'PROTO_CANONICAL', 1 );
 253+define( 'PROTO_INTERNAL', 2 );
Index: branches/REL1_18/phase3/includes/GlobalFunctions.php
@@ -433,6 +433,7 @@
434434 * PROTO_RELATIVE: Output a URL starting with // (protocol-relative URL)
435435 * PROTO_CURRENT: Output a URL starting with either http:// or https:// , depending on which protocol was used for the current incoming request
436436 * 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
437438 *
438439 * @todo this won't work with current-path-relative URLs
439440 * like "subdir/foo.html", etc.
@@ -442,9 +443,15 @@
443444 * @return string Fully-qualified URL
444445 */
445446 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+ }
449456 if ( $defaultProto === PROTO_CURRENT ) {
450457 $defaultProto = WebRequest::detectProtocol() . '://';
451458 }
@@ -453,11 +460,11 @@
454461 $bits = wfParseUrl( $serverUrl );
455462 $serverHasProto = $bits && $bits['scheme'] != '';
456463
457 - if ( $defaultProto === PROTO_CANONICAL ) {
 464+ if ( $defaultProto === PROTO_CANONICAL || $defaultProto === PROTO_INTERNAL ) {
458465 if ( $serverHasProto ) {
459466 $defaultProto = $bits['scheme'] . '://';
460467 } 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
462469 // Fall back to HTTP in this ridiculous case
463470 $defaultProto = PROTO_HTTP;
464471 }
Property changes on: branches/REL1_18/phase3/includes/GlobalFunctions.php
___________________________________________________________________
Modified: svn:mergeinfo
465472 Merged /trunk/phase3/includes/GlobalFunctions.php:r96437-96438,98235,98374
Index: branches/REL1_18/phase3/includes/objectcache/MemcachedClient.php
@@ -958,6 +958,12 @@
959959 } else {
960960 $this->stats[$cmd] = 1;
961961 }
 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+ }
962968
963969 $flags = 0;
964970
Index: branches/REL1_18/phase3/includes/OutputPage.php
@@ -118,6 +118,7 @@
119119 // @todo FIXME: Next variables probably comes from the resource loader
120120 var $mModules = array(), $mModuleScripts = array(), $mModuleStyles = array(), $mModuleMessages = array();
121121 var $mResourceLoader;
 122+ var $mJsConfigVars = array();
122123
123124 /** @todo FIXME: Is this still used ?*/
124125 var $mInlineMsg = array();
@@ -1314,7 +1315,7 @@
13151316 }
13161317
13171318 /**
1318 - * Add wikitext with a custom Title object and
 1319+ * Add wikitext with a custom Title object and tidy enabled.
13191320 *
13201321 * @param $text String: wikitext
13211322 * @param $title Title object
@@ -2576,11 +2577,29 @@
25772578 }
25782579
25792580 /**
2580 - * Get an array containing global JS variables
 2581+ * Add one or more variables to be set in mw.config in JavaScript.
25812582 *
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
25852604 * have to be purged on configuration changes.
25862605 */
25872606 protected function getJSVars() {
@@ -2623,10 +2642,14 @@
26242643 $vars['wgIsMainPage'] = true;
26252644 }
26262645
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.
26282650 wfRunHooks( 'MakeGlobalVariablesScript', array( &$vars ) );
26292651
2630 - return $vars;
 2652+ // Merge in variables from addJsConfigVars last
 2653+ return array_merge( $vars, $this->mJsConfigVars );
26312654 }
26322655
26332656 /**
Property changes on: branches/REL1_18/phase3/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
26342657 Merged /trunk/phase3/includes/OutputPage.php:r98374
Index: branches/REL1_18/phase3/includes/cache/SquidUpdate.php
@@ -221,11 +221,6 @@
222222 * @return string
223223 */
224224 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 );
231226 }
232227 }
Index: branches/REL1_18/phase3/includes/specials/SpecialProtectedtitles.php
@@ -78,10 +78,12 @@
7979
8080 wfProfileIn( __METHOD__ );
8181
82 - static $skin = null;
 82+ static $skin = null, $infinity = null;
8383
84 - if( is_null( $skin ) )
 84+ if( is_null( $skin ) ){
8585 $skin = $this->getSkin();
 86+ $infinity = wfGetDB( DB_SLAVE )->getInfinity();
 87+ }
8688
8789 $title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
8890 $link = $skin->link( $title );
@@ -92,12 +94,12 @@
9395
9496 $description_items[] = $protType;
9597
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 ) {
98100
99101 $expiry_description = wfMsg( 'protect-expiring', $wgLang->timeanddate( $expiry ) , $wgLang->date( $expiry ) , $wgLang->time( $expiry ) );
100102
101 - $description_items[] = $expiry_description;
 103+ $description_items[] = htmlspecialchars($expiry_description);
102104 }
103105
104106 wfProfileOut( __METHOD__ );
Property changes on: branches/REL1_18/phase3/includes/specials
___________________________________________________________________
Modified: svn:mergeinfo
105107 Merged /trunk/phase3/includes/specials:r93726,94199,96437-96438,98235,98374
Property changes on: branches/REL1_18/phase3/includes
___________________________________________________________________
Modified: svn:mergeinfo
106108 Merged /trunk/phase3/includes:r93726,94199,96437-96438,98235,98374
Property changes on: branches/REL1_18/phase3
___________________________________________________________________
Modified: svn:mergeinfo
107109 Merged /trunk/phase3:r93726,94199,96437-96438,96579,98235,98374

Follow-up revisions

RevisionCommit summaryAuthorDate
r99981After merging r98374 into REL1_18 in r99980, move RELEASE-NOTES to 1.18reedy22:14, 16 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93726Fixing Special:Protectedtitles to match Special:Protectedpages. This prevents...rotem11:43, 2 August 2011
r94199Merge r93797 to trunk, in a somewhat modified form: clamp expiries for memcac...catrope21:15, 10 August 2011
r96437Actually fix bug 30792, despite my earlier claims. SquidUpdate::purge('//uplo...catrope14:15, 7 September 2011
r96438Followup r96437: actually define PROTO_INTERNALcatrope14:17, 7 September 2011
r98235(bug 31088) [Regression] "Create account/log in" should use the current title...aaron18:55, 27 September 2011
r98734[RL2] Make export form nicer and list the actual page titles as an unordered ...krinkle02:38, 3 October 2011

Status & tagging log