r80175 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80174‎ | r80175 | r80176 >
Date:17:13, 13 January 2011
Author:catrope
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/REL1_17/phase3/includes/Linker.php (modified) (history)
  • /branches/REL1_17/phase3/includes/libs/CSSMin.php (modified) (history)
  • /branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php (modified) (history)
  • /branches/REL1_17/phase3/maintenance/cleanupRemovedModules.php (modified) (history)
  • /branches/REL1_17/phase3/resources/jquery/jquery.client.js (modified) (history)
  • /branches/REL1_17/phase3/resources/jquery/jquery.localize.js (modified) (history)
  • /branches/REL1_17/phase3/resources/mediawiki/mediawiki.js (modified) (history)
  • /branches/REL1_17/phase3/skins/CologneBlue.php (modified) (history)
  • /branches/REL1_17/phase3/skins/Standard.php (modified) (history)
  • /branches/REL1_17/phase3/skins/Vector.php (modified) (history)
  • /branches/REL1_17/phase3/skins/common/quickbar-right.css (deleted) (history)
  • /branches/REL1_17/phase3/skins/common/quickbar.css (deleted) (history)
  • /branches/REL1_17/phase3/skins/vector/csshover.min.htc (added) (history)

Diff [purge]

Index: branches/REL1_17/phase3/maintenance/cleanupRemovedModules.php
@@ -37,17 +37,18 @@
3838 public function execute() {
3939 $dbw = wfGetDB( DB_MASTER );
4040 $rl = new ResourceLoader();
41 - $moduleNames = array_keys( $rl->getModules() );
 41+ $moduleNames = $rl->getModuleNames();
4242 $moduleList = implode( ', ', array_map( array( $dbw, 'addQuotes' ), $moduleNames ) );
4343 $limit = max( 1, intval( $this->getOption( 'batchsize', 500 ) ) );
4444 $maxlag = intval( $this->getOption( 'max-slave-lag', 5 ) );
4545
4646 $this->output( "Cleaning up module_deps table...\n" );
4747 $i = 1;
 48+ $modDeps = $dbw->tableName( 'module_deps' );
4849 do {
4950 // $dbw->delete() doesn't support LIMIT :(
5051 $where = $moduleList ? "md_module NOT IN ($moduleList)" : '1=1';
51 - $dbw->query( "DELETE FROM module_deps WHERE $where LIMIT $limit", __METHOD__ );
 52+ $dbw->query( "DELETE FROM $modDeps WHERE $where LIMIT $limit", __METHOD__ );
5253 $numRows = $dbw->affectedRows();
5354 $this->output( "Batch $i: $numRows rows\n" );
5455 $i++;
@@ -57,9 +58,11 @@
5859
5960 $this->output( "Cleaning up msg_resource table...\n" );
6061 $i = 1;
 62+
 63+ $mrRes = $dbw->tableName( 'msg_resource' );
6164 do {
6265 $where = $moduleList ? "mr_resource NOT IN ($moduleList)" : '1=1';
63 - $dbw->query( "DELETE FROM msg_resource WHERE $where LIMIT $limit", __METHOD__ );
 66+ $dbw->query( "DELETE FROM $mrRes WHERE $where LIMIT $limit", __METHOD__ );
6467 $numRows = $dbw->affectedRows();
6568 $this->output( "Batch $i: $numRows rows\n" );
6669 $i++;
@@ -69,9 +72,10 @@
7073
7174 $this->output( "Cleaning up msg_resource_links table...\n" );
7275 $i = 1;
 76+ $msgResLinks = $dbw->tableName( 'msg_resource_links' );
7377 do {
7478 $where = $moduleList ? "mrl_resource NOT IN ($moduleList)" : '1=1';
75 - $dbw->query( "DELETE FROM msg_resource_links WHERE $where LIMIT $limit", __METHOD__ );
 79+ $dbw->query( "DELETE FROM $msgResLinks WHERE $where LIMIT $limit", __METHOD__ );
7680 $numRows = $dbw->affectedRows();
7781 $this->output( "Batch $i: $numRows rows\n" );
7882 $i++;
Index: branches/REL1_17/phase3/skins/CologneBlue.php
@@ -106,28 +106,33 @@
107107 return $s;
108108 }
109109
110 - function reallyGenerateUserStylesheet() {
111 - $s = parent::reallyGenerateUserStylesheet();
 110+ function setupSkinUserCss( OutputPage $out ){
 111+ global $wgContLang;
112112 $qb = $this->qbSetting();
113113
114114 if ( 2 == $qb ) { # Right
115 - $s .= "#quickbar { position: absolute; right: 4px; }\n" .
116 - "#article { margin-left: 4px; margin-right: 148px; }\n";
 115+ $rules[] = "#quickbar { position: absolute; right: 4px; }";
 116+ $rules[] = "#article { margin-left: 4px; margin-right: 148px; }";
117117 } elseif ( 1 == $qb ) {
118 - $s .= "#quickbar { position: absolute; left: 4px; }\n" .
119 - "#article { margin-left: 148px; margin-right: 4px; }\n";
 118+ $rules[] = "#quickbar { position: absolute; left: 4px; }";
 119+ $rules[] = "#article { margin-left: 148px; margin-right: 4px; }";
120120 } elseif ( 3 == $qb ) { # Floating left
121 - $s .= "#quickbar { position:absolute; left:4px } \n" .
122 - "#topbar { margin-left: 148px }\n" .
123 - "#article { margin-left:148px; margin-right: 4px; } \n" .
124 - "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;} \n"; # Hides from IE
 121+ $rules[] = "#quickbar { position:absolute; left:4px }";
 122+ $rules[] = "#topbar { margin-left: 148px }";
 123+ $rules[] = "#article { margin-left:148px; margin-right: 4px; }";
 124+ $rules[] = "body>#quickbar { position:fixed; left:4px; top:4px; overflow:auto ;bottom:4px;}"; # Hides from IE
125125 } elseif ( 4 == $qb ) { # Floating right
126 - $s .= "#quickbar { position: fixed; right: 4px; } \n" .
127 - "#topbar { margin-right: 148px }\n" .
128 - "#article { margin-right: 148px; margin-left: 4px; } \n" .
129 - "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;} \n"; # Hides from IE
 126+ $rules[] = "#quickbar { position: fixed; right: 4px; }";
 127+ $rules[] = "#topbar { margin-right: 148px }";
 128+ $rules[] = "#article { margin-right: 148px; margin-left: 4px; }";
 129+ $rules[] = "body>#quickbar { position: fixed; right: 4px; top: 4px; overflow: auto ;bottom:4px;}"; # Hides from IE
130130 }
131 - return $s;
 131+ $style = implode( "\n", $rules );
 132+ if ( $wgContLang->getDir() === 'rtl' ) {
 133+ $style = CSSJanus::transform( $style, true, false );
 134+ }
 135+ $out->addInlineStyle( $style );
 136+ parent::setupSkinUserCss( $out );
132137 }
133138
134139 function sysLinks() {
Index: branches/REL1_17/phase3/skins/Standard.php
@@ -20,34 +20,28 @@
2121 *
2222 */
2323 function setupSkinUserCss( OutputPage $out ){
24 - if ( 3 == $this->qbSetting() ) { # Floating left
25 - $out->addStyle( 'common/quickbar.css' );
26 - } elseif ( 4 == $this->qbSetting() ) { # Floating right
27 - $out->addStyle( 'common/quickbar-right.css' );
28 - }
29 - parent::setupSkinUserCss( $out );
30 - }
31 -
32 - /**
33 - *
34 - */
35 - function reallyGenerateUserStylesheet() {
36 - $s = parent::reallyGenerateUserStylesheet();
 24+ global $wgContLang;
3725 $qb = $this->qbSetting();
38 -
3926 if ( 2 == $qb ) { # Right
40 - $s .= "#quickbar { position: absolute; top: 4px; right: 4px; " .
41 - "border-left: 2px solid #000000; }\n" .
42 - "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }\n";
 27+ $rules[] = "#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
 28+ $rules[] = "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
4329 } elseif ( 1 == $qb || 3 == $qb ) {
44 - $s .= "#quickbar { position: absolute; top: 4px; left: 4px; " .
45 - "border-right: 1px solid gray; }\n" .
46 - "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }\n";
 30+ $rules[] = "#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
 31+ $rules[] = "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
 32+ if( 3 == $qb ) {
 33+ $rules[] = "#quickbar { position: fixed; padding: 4px; }";
 34+ }
4735 } elseif ( 4 == $qb ) {
48 - $s .= "#quickbar { border-right: 1px solid gray; }\n" .
49 - "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }\n";
 36+ $rules[] = "#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}";
 37+ $rules[] = "#quickbar { border-right: 1px solid gray; }";
 38+ $rules[] = "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
5039 }
51 - return $s;
 40+ $style = implode( "\n", $rules );
 41+ if ( $wgContLang->getDir() === 'rtl' ) {
 42+ $style = CSSJanus::transform( $style, true, false );
 43+ }
 44+ $out->addInlineStyle( $style );
 45+ parent::setupSkinUserCss( $out );
5246 }
5347
5448 function doAfterContent() {
Index: branches/REL1_17/phase3/skins/common/quickbar.css
@@ -1 +0,0 @@
2 -#quickbar { position: fixed; padding: 4px; }
Index: branches/REL1_17/phase3/skins/common/quickbar-right.css
@@ -1 +0,0 @@
2 -#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}
Index: branches/REL1_17/phase3/skins/Vector.php
@@ -27,17 +27,18 @@
2828 * @param $out OutputPage object to initialize
2929 */
3030 public function initPage( OutputPage $out ) {
31 - global $wgLocalStylePath;
 31+ global $wgLocalStylePath, $wgRequest;
3232
3333 parent::initPage( $out );
34 -
 34+
3535 // Append CSS which includes IE only behavior fixes for hover support -
3636 // this is better than including this in a CSS fille since it doesn't
3737 // wait for the CSS file to load before fetching the HTC file.
38 - $out->addScript(
 38+ $min = $wgRequest->getFuzzyBool( 'debug' ) ? '' : '.min';
 39+ $out->addHeadItem( 'csshover',
3940 '<!--[if lt IE 7]><style type="text/css">body{behavior:url("' .
4041 htmlspecialchars( $wgLocalStylePath ) .
41 - "/{$this->stylename}/csshover.htc\")}</style><![endif]-->"
 42+ "/{$this->stylename}/csshover{$min}.htc\")}</style><![endif]-->"
4243 );
4344 }
4445
Property changes on: branches/REL1_17/phase3/skins/Vector.php
___________________________________________________________________
Modified: svn:mergeinfo
4546 Merged /trunk/phase3/skins/Vector.php:r79960,80034,80036,80043-80044,80050,80053,80074-80077,80104,80112,80116,80119-80120
Index: branches/REL1_17/phase3/skins/vector/csshover.min.htc
@@ -0,0 +1,12 @@
 2+<public:attach event="ondocumentready" onevent="CSSHover()" />
 3+<script>
 4+/**
 5+ * Whatever:hover - V3.11
 6+ * http://www.xs4all.nl/~peterned/
 7+ *
 8+ * Copyright (c) 2009 Peter Nederlof
 9+ * Licensed under the LGPL license
 10+ * http://creativecommons.org/licenses/LGPL/2.1
 11+ */
 12+window.CSSHover=(function(){var m=/(^|\s)((([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active|focus))/i;var n=/(.*?)\:(hover|active|focus)/i;var o=/[^:]+:([a-z\-]+).*/i;var p=/(\.([a-z0-9_\-]+):[a-z]+)|(:[a-z]+)/gi;var q=/\.([a-z0-9_\-]*on(hover|active|focus))/i;var s=/msie (5|6|7)/i;var t=/backcompat/i;var u={index:0,list:['text-kashida','text-kashida-space','text-justify'],get:function(){return this.list[(this.index++)%this.list.length]}};var v=function(c){return c.replace(/-(.)/mg,function(a,b){return b.toUpperCase()})};var w={elements:[],callbacks:{},init:function(){if(!s.test(navigator.userAgent)&&!t.test(window.document.compatMode)){return}var a=window.document.styleSheets,l=a.length;for(var i=0;i<l;i++){this.parseStylesheet(a[i])}},parseStylesheet:function(a){if(a.imports){try{var b=a.imports;var l=b.length;for(var i=0;i<l;i++){this.parseStylesheet(a.imports[i])}}catch(securityException){}}try{var c=a.rules;var r=c.length;for(var j=0;j<r;j++){this.parseCSSRule(c[j],a)}}catch(someException){}},parseCSSRule:function(a,b){var c=a.selectorText;if(m.test(c)){var d=a.style.cssText;var e=n.exec(c)[1];var f=c.replace(o,'on$1');var g=c.replace(p,'.$2'+f);var h=q.exec(g)[1];var i=e+h;if(!this.callbacks[i]){var j=u.get();var k=v(j);b.addRule(e,j+':expression(CSSHover(this, "'+f+'", "'+h+'", "'+k+'"))');this.callbacks[i]=true}b.addRule(g,d)}},patch:function(a,b,c,d){try{var f=a.parentNode.currentStyle[d];a.style[d]=f}catch(e){a.runtimeStyle[d]=''}if(!a.csshover){a.csshover=[]}if(!a.csshover[c]){a.csshover[c]=true;var g=new CSSHoverElement(a,b,c);this.elements.push(g)}return b},unload:function(){try{var l=this.elements.length;for(var i=0;i<l;i++){this.elements[i].unload()}this.elements=[];this.callbacks={}}catch(e){}}};var x={onhover:{activator:'onmouseenter',deactivator:'onmouseleave'},onactive:{activator:'onmousedown',deactivator:'onmouseup'},onfocus:{activator:'onfocus',deactivator:'onblur'}};function CSSHoverElement(a,b,c){this.node=a;this.type=b;var d=new RegExp('(^|\\s)'+c+'(\\s|$)','g');this.activator=function(){a.className+=' '+c};this.deactivator=function(){a.className=a.className.replace(d,' ')};a.attachEvent(x[b].activator,this.activator);a.attachEvent(x[b].deactivator,this.deactivator)}CSSHoverElement.prototype={unload:function(){this.node.detachEvent(x[this.type].activator,this.activator);this.node.detachEvent(x[this.type].deactivator,this.deactivator);this.activator=null;this.deactivator=null;this.node=null;this.type=null}};window.attachEvent('onbeforeunload',function(){w.unload()});return function(a,b,c,d){if(a){return w.patch(a,b,c,d)}else{w.init()}}})();
 13+</script>
Property changes on: branches/REL1_17/phase3/skins/vector/csshover.min.htc
___________________________________________________________________
Added: svn:eol-style
114 + native
Index: branches/REL1_17/phase3/includes/Linker.php
@@ -159,6 +159,7 @@
160160 public function link( $target, $text = null, $customAttribs = array(), $query = array(), $options = array() ) {
161161 wfProfileIn( __METHOD__ );
162162 if ( !$target instanceof Title ) {
 163+ wfProfileOut( __METHOD__ );
163164 return "<!-- ERROR -->$text";
164165 }
165166 $options = (array)$options;
Index: branches/REL1_17/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -75,7 +75,7 @@
7676 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(),
7777 'wgNamespaceIds' => $wgContLang->getNamespaceIds(),
7878 'wgSiteName' => $wgSitename,
79 - 'wgFileExtensions' => $wgFileExtensions,
 79+ 'wgFileExtensions' => array_values( $wgFileExtensions ),
8080 'wgDBname' => $wgDBname,
8181 );
8282 if ( $wgContLang->hasVariants() ) {
Index: branches/REL1_17/phase3/includes/libs/CSSMin.php
@@ -36,7 +36,7 @@
3737 * which when base64 encoded will result in a 1/3 increase in size.
3838 */
3939 const EMBED_SIZE_LIMIT = 24576;
40 - const URL_REGEX = 'url\([\'"]?(?P<file>[^\?\)\:\'"]*)\??[^\)\'"]*[\'"]?\)';
 40+ const URL_REGEX = 'url\(\s*[\'"]?(?P<file>[^\?\)\:\'"]*)\??[^\)\'"]*[\'"]?\s*\)';
4141
4242 /* Protected Static Members */
4343
Index: branches/REL1_17/phase3/resources/jquery/jquery.localize.js
@@ -6,13 +6,15 @@
77 * with localized text, elements with title-msg and alt-msg attributes will receive localized title
88 * and alt attributes.
99 *
 10+ * Note that "msg" elements must have html namespacing such as "<html:msg />" to be compatible with
 11+ * Internet Explorer.
 12+ *
1013 * Example:
11 - *
12 - * <p class="somethingCool">
13 - * <msg key="my-message" />
14 - * <img src="something.jpg" title-msg="my-title-message" alt-msg="my-alt-message" />
15 - * </p>
16 - *
 14+ * <p class="somethingCool">
 15+ * <html:msg key="my-message" />
 16+ * <img src="something.jpg" title-msg="my-title-message" alt-msg="my-alt-message" />
 17+ * </p>
 18+ *
1719 * Localizes to...
1820 *
1921 * <p class="somethingCool">
@@ -30,10 +32,11 @@
3133 * @param Object: options Map of options
3234 * * prefix: Message prefix to use when localizing elements and attributes
3335 */
 36+
3437 $.fn.localize = function( options ) {
3538 options = $.extend( { 'prefix': '' }, options );
3639 return $(this)
37 - .find( 'msg' )
 40+ .find( 'msg,html\\:msg' )
3841 .each( function() {
3942 $(this)
4043 .text( mediaWiki.msg( options.prefix + $(this).attr( 'key' ) ) )
@@ -56,3 +59,6 @@
5760 .end();
5861 };
5962 } )( jQuery, mediaWiki );
 63+
 64+// Let IE know about the msg tag before it's used...
 65+document.createElement( 'msg' );
Index: branches/REL1_17/phase3/resources/jquery/jquery.client.js
@@ -169,7 +169,7 @@
170170 var profile = jQuery.client.profile();
171171 var dir = jQuery( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr';
172172 // Check over each browser condition to determine if we are running in a compatible client
173 - if ( typeof map[dir] !== 'object' || map[dir][profile.name] !== 'object' ) {
 173+ if ( typeof map[dir] !== 'object' || typeof map[dir][profile.name] === 'undefined' ) {
174174 // Unknown, so we assume it's working
175175 return true;
176176 }
@@ -191,4 +191,13 @@
192192 }
193193 return true;
194194 }
195 -} )();
\ No newline at end of file
 195+} )();
 196+
 197+$( document ).ready( function() {
 198+ var profile = $.client.profile();
 199+ $( 'html' )
 200+ .addClass( 'client-' + profile.name )
 201+ .addClass( 'client-' + profile.name + '-' + profile.versionBase )
 202+ .addClass( 'client-' + profile.layout )
 203+ .addClass( 'client-' + profile.platform );
 204+} );
Property changes on: branches/REL1_17/phase3/resources/mediawiki/mediawiki.js
___________________________________________________________________
Modified: svn:mergeinfo
196205 Merged /trunk/phase3/resources/mediawiki/mediawiki.js:r79960,80034,80036,80043-80044,80050,80053,80074-80077,80104,80112,80116,80119-80120

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79960Resolves bug #26655 - adds support for space before and after the URL inside ...tparscal21:31, 10 January 2011
r80034Repair quickbar of standard and cologneblue skins to work under Resourceloader....hartman20:22, 11 January 2011
r80036Included client in the initial payload. Restored functionality that used to e...tparscal20:56, 11 January 2011
r80043Fixed logic error that caused the test to always pass.tparscal21:55, 11 January 2011
r80044A wfProfileOut was missing (which messed up profiling sometimes). Thanks to ...sean_colombo22:20, 11 January 2011
r80050Reverts part of r80036 - jquery.client is already depended on by mediaWiki.ut...tparscal23:10, 11 January 2011
r80053Fixed logic error - all tests were passing... :(tparscal23:15, 11 January 2011
r80074Followup r75575...reedy02:12, 12 January 2011
r80075Follwup r75575, honour table prefixes. Bad Roan ;)reedy02:16, 12 January 2011
r80076Fix typo from r80075...reedy02:19, 12 January 2011
r80077Fix another typo in r80075reedy02:20, 12 January 2011
r80104Per CR on r75575, remove array_keys() as getModuleNames has array_key'd the r...reedy19:03, 12 January 2011
r80112Added compressed version of csshover 3.11. Also fixed major issue where inclu...tparscal20:01, 12 January 2011
r80116Fixed IE bug, you must use html:msg for the msg elements that jquery.localize...tparscal20:43, 12 January 2011
r80119Fix issue with missing keys in $wgFileExtensions caused by an array_diff() so...catrope20:58, 12 January 2011
r80120Fix properties in r80112catrope21:01, 12 January 2011

Status & tagging log