r61058 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61057‎ | r61058 | r61059 >
Date:19:39, 14 January 2010
Author:ialex
Status:ok (Comments)
Tags:
Comment:
* (bug 21303) Comments are no longer stripped from MediaWiki:Common.js and skin-specific JS pages (those message no longer have their wikitext variables replaced)
* Removed a trailing space in RELEASE-NOTES
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Skin.php
@@ -498,14 +498,14 @@
499499
500500 wfProfileIn( __METHOD__ );
501501 if( !$skinName ) {
502 - $skinName = $this->getSkinName();
 502+ $skinName = $this->getSkinName();
503503 }
504504
505505 $s = "/* generated javascript */\n";
506506 $s .= "var skin = '" . Xml::escapeJsString($skinName ) . "';\n";
507507 $s .= "var stylepath = '" . Xml::escapeJsString( $wgStylePath ) . "';";
508508 $s .= "\n\n/* MediaWiki:Common.js */\n";
509 - $commonJs = wfMsgForContent( 'common.js' );
 509+ $commonJs = wfMsgExt( 'common.js', 'content' );
510510 if ( !wfEmptyMsg( 'common.js', $commonJs ) ) {
511511 $s .= $commonJs;
512512 }
@@ -514,7 +514,7 @@
515515 // avoid inclusion of non defined user JavaScript (with custom skins only)
516516 // by checking for default message content
517517 $msgKey = ucfirst( $skinName ) . '.js';
518 - $userJS = wfMsgForContent( $msgKey );
 518+ $userJS = wfMsgExt( $msgKey, 'content' );
519519 if ( !wfEmptyMsg( $msgKey, $userJS ) ) {
520520 $s .= $userJS;
521521 }
Index: trunk/phase3/RELEASE-NOTES
@@ -704,11 +704,13 @@
705705 * (bug 9794) User rights log entries for foreign user now links to the foreign
706706 user's page if possible
707707 * (bug 14717) Don't load nonexistent CSS fix files for non-Monobook skins
708 -* (bug 18765) Increased consistency of bold-italic markup for unbalanced quotes.
 708+* (bug 18765) Increased consistency of bold-italic markup for unbalanced quotes.
709709 Improved representation of six quotes (may break existing markup).
710710 * (bug 22034) Use wfClientAcceptsGzip() in wfGzipHandler instead of
711711 reimplementing it.
712712 * (bug 19226) First line renders differently on many UI messages.
 713+* (bug 21303) Comments are no longer stripped from MediaWiki:Common.js and
 714+ skin-specific JS pages
713715
714716 == API changes in 1.16 ==
715717

Comments

#Comment by Ciencia Al Poder (talk | contribs)   14:21, 29 January 2011

This change has made template transclusion inside the gen=js generated code impossible.

We had the code in MediaWiki:Common.js split in several subpages, and all transcluded in Common.js. That worked fine until we upgraded to MediaWiki 1.16.

Maybe it's not a common use in those JavaScript files, which also had required wrapping the code between /*<pre>*/ and /*</pre>*/ because of the transclusion, but since it's something that we relied upon until now and helps a lot for having separate code, specially because we have 2 subpages for each: One with the complete code and other with the code compressed, which is the transcluded one.

Maybe it's not worth opening a bug for that since the change happened 1 year ago and other wikis may be using template code in them without wrapping them around pre.

#Comment by Catrope (talk | contribs)   14:09, 2 February 2011

Transclusion and other parsing of JS pages as if they were wikitext sounds deeply evil to me.

#Comment by Ciencia Al Poder (talk | contribs)   20:02, 2 February 2011

When you have a lot of code to maintain and optimize, it's a very good way. But since the change was made I just made a workaround: A separate Common.js that does the transclusion.

It also increases site spedd since gen=js has a cache-control: no-cache, while a separate file is cached. Since now the Common.js has little code, the big file is cached more time and reduces network traffic.

Status & tagging log