r94557 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94556‎ | r94557 | r94558 >
Date:20:12, 15 August 2011
Author:catrope
Status:ok
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.17wmf1/includes/UserMailer.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/WikiMap.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/media/Bitmap.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/media/SVGMetadataExtractor.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/resourceloader/ResourceLoaderWikiModule.php (modified) (history)
  • /branches/wmf/1.17wmf1/resources/mediawiki.util/mediawiki.util.js (modified) (history)
  • /branches/wmf/1.17wmf1/resources/mediawiki/mediawiki.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/UserMailer.php
@@ -466,7 +466,7 @@
467467 $keys = array();
468468
469469 if ( $this->oldid ) {
470 - $difflink = $this->title->getFullUrl( 'diff=0&oldid=' . $this->oldid );
 470+ $difflink = wfExpandUrl( $this->title->getFullUrl( 'diff=0&oldid=' . $this->oldid ), PROTO_HTTP );
471471 $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited', $difflink );
472472 $keys['$OLDID'] = $this->oldid;
473473 $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'changed' );
@@ -483,17 +483,17 @@
484484 * revision.
485485 */
486486 $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastdiff',
487 - $this->title->getFullURL( "oldid={$this->oldid}&diff=next" ) );
 487+ wfExpandUrl( $this->title->getFullURL( "oldid={$this->oldid}&diff=next" ), PROTO_HTTP ) );
488488 }
489489
490490 $body = strtr( $body, $keys );
491491 $pagetitle = $this->title->getPrefixedText();
492492 $keys['$PAGETITLE'] = $pagetitle;
493 - $keys['$PAGETITLE_URL'] = $this->title->getFullUrl();
 493+ $keys['$PAGETITLE_URL'] = wfExpandUrl( $this->title->getFullUrl(), PROTO_HTTP );
494494
495495 $keys['$PAGEMINOREDIT'] = $medit;
496496 $keys['$PAGESUMMARY'] = $summary;
497 - $keys['$UNWATCHURL'] = $this->title->getFullUrl( 'action=unwatch' );
 497+ $keys['$UNWATCHURL'] = wfExpandUrl( $this->title->getFullUrl( 'action=unwatch' ), PROTO_HTTP );
498498
499499 $subject = strtr( $subject, $keys );
500500
@@ -528,10 +528,10 @@
529529 $subject = str_replace( '$PAGEEDITOR', $name, $subject );
530530 $keys['$PAGEEDITOR'] = $name;
531531 $emailPage = SpecialPage::getSafeTitleFor( 'Emailuser', $name );
532 - $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getFullUrl();
 532+ $keys['$PAGEEDITOR_EMAIL'] = wfExpandUrl( $emailPage->getFullUrl(), PROTO_HTTP );
533533 }
534534 $userPage = $editor->getUserPage();
535 - $keys['$PAGEEDITOR_WIKI'] = $userPage->getFullUrl();
 535+ $keys['$PAGEEDITOR_WIKI'] = wfExpandUrl( $userPage->getFullUrl(), PROTO_HTTP );
536536 $body = strtr( $body, $keys );
537537 $body = wordwrap( $body, 72 );
538538
Index: branches/wmf/1.17wmf1/includes/resourceloader/ResourceLoaderWikiModule.php
@@ -66,7 +66,7 @@
6767 continue;
6868 }
6969 $title = Title::newFromText( $titleText );
70 - if ( !$title ) {
 70+ if ( !$title || $title->isRedirect() ) {
7171 continue;
7272 }
7373 $script = $this->getContent( $title );
@@ -89,7 +89,7 @@
9090 continue;
9191 }
9292 $title = Title::newFromText( $titleText );
93 - if ( !$title ) {
 93+ if ( !$title || $title->isRedirect() ) {
9494 continue;
9595 }
9696 $media = isset( $options['media'] ) ? $options['media'] : 'all';
Index: branches/wmf/1.17wmf1/includes/media/Bitmap.php
@@ -215,7 +215,7 @@
216216 // We optimize the output, but -optimize is broken,
217217 // use optimizeTransparency instead (bug 11822)
218218 if ( version_compare( $this->getMagickVersion(), "6.3.5" ) >= 0 ) {
219 - $animation_post = '-fuzz 5% -layers optimizeTransparency +map';
 219+ $animation_post = '-fuzz 5% -layers optimizeTransparency';
220220 }
221221 }
222222 }
Property changes on: branches/wmf/1.17wmf1/includes/media/Bitmap.php
___________________________________________________________________
Added: svn:mergeinfo
223223 Merged /branches/new-installer/phase3/includes/media/Bitmap.php:r43664-66004
224224 Merged /branches/wmf-deployment/includes/media/Bitmap.php:r53381,60970
225225 Merged /branches/REL1_15/phase3/includes/media/Bitmap.php:r51646
226226 Merged /branches/wmf/1.16wmf4/includes/media/Bitmap.php:r67177,69199,76243,77266
227227 Merged /branches/sqlite/includes/media/Bitmap.php:r58211-58321
228228 Merged /trunk/phase3/includes/media/Bitmap.php:r83590,87099,89512-89513,90729,93141,93891,94155,94277,94372
Index: branches/wmf/1.17wmf1/includes/media/SVGMetadataExtractor.php
@@ -55,7 +55,7 @@
5656 $size = filesize( $source );
5757 if ( $size === false ) {
5858 throw new MWException( "Error getting filesize of SVG." );
59 - }
 59+ }
6060
6161 if ( $size > $wgSVGMetadataCutoff ) {
6262 $this->debug( "SVG is $size bytes, which is bigger than $wgSVGMetadataCutoff. Truncating." );
@@ -157,7 +157,7 @@
158158 }
159159 $keepReading = $this->reader->read();
160160 while( $keepReading ) {
161 - if( $this->reader->localName == $name && $this->namespaceURI == self::NS_SVG && $this->reader->nodeType == XmlReader::END_ELEMENT ) {
 161+ if( $this->reader->localName == $name && $this->reader->namespaceURI == self::NS_SVG && $this->reader->nodeType == XmlReader::END_ELEMENT ) {
162162 break;
163163 } elseif( $this->reader->nodeType == XmlReader::TEXT ){
164164 $this->metadata[$metafield] = trim( $this->reader->value );
Index: branches/wmf/1.17wmf1/includes/WikiMap.php
@@ -132,11 +132,13 @@
133133 */
134134 public function getDisplayName() {
135135 $url = $this->getUrl( '' );
136 - $url = preg_replace( '!^https?://!', '', $url );
137 - $url = preg_replace( '!/index\.php(\?title=|/)$!', '/', $url );
138 - $url = preg_replace( '!/wiki/$!', '/', $url );
139 - $url = preg_replace( '!/$!', '', $url );
140 - return $url;
 136+ $parsed = wfParseUrl( $url );
 137+ if ( $parsed ) {
 138+ return $parsed['host'];
 139+ } else {
 140+ // Invalid URL. There's no sane thing to do here, so just return it
 141+ return $url;
 142+ }
141143 }
142144
143145 /**
Index: branches/wmf/1.17wmf1/resources/mediawiki.util/mediawiki.util.js
@@ -147,7 +147,7 @@
148148 'getParamValue' : function( param, url ) {
149149 url = url ? url : document.location.href;
150150 // Get last match, stop at hash
151 - var re = new RegExp( '[^#]*[&?]' + $.escapeRE( param ) + '=([^&#]*)' );
 151+ var re = new RegExp( '^[^#]*[&?]' + $.escapeRE( param ) + '=([^&#]*)' );
152152 var m = re.exec( url );
153153 if ( m && m.length > 1 ) {
154154 return decodeURIComponent( m[1] );
@@ -292,9 +292,14 @@
293293 // Unhide portlet if it was hidden before
294294 $portlet.removeClass( 'emptyPortlet' );
295295
296 - // Wrap the anchor tag in a <span> and create a list item for it
 296+ // Wrap the anchor tag in a list item (and a span if $portlet is a Vector tab)
297297 // and back up the selector to the list item
298 - var $item = $link.wrap( '<li><span></span></li>' ).parent().parent();
 298+ var $item;
 299+ if ( $portlet.hasClass( 'vectorTabs' ) ) {
 300+ $item = $link.wrap( '<li><span></span></li>' ).parent().parent();
 301+ } else {
 302+ $item = $link.wrap( '<li></li>' ).parent();
 303+ }
299304
300305 // Implement the properties passed to the function
301306 if ( id ) {
Property changes on: branches/wmf/1.17wmf1/resources/mediawiki.util/mediawiki.util.js
___________________________________________________________________
Added: svn:mergeinfo
302307 Merged /branches/REL1_15/phase3/resources/mediawiki.util/mediawiki.util.js:r51646
303308 Merged /branches/wmf/1.16wmf4/resources/mediawiki.util/mediawiki.util.js:r67177,69199,76243,77266
304309 Merged /branches/sqlite/resources/mediawiki.util/mediawiki.util.js:r58211-58321
305310 Merged /trunk/phase3/resources/mediawiki.util/mediawiki.util.js:r79828,79830,79848,79853,79950-79951,79954,79989,80006-80007,80013,80016,80080,80083,80124,80128,80238,80406,81833,83212,83590,90729,93141,93891,94155,94277,94372
306311 Merged /trunk/phase3/resources/mediawiki/mediawiki.util.js:r90729,93517
307312 Merged /branches/new-installer/phase3/resources/mediawiki.util/mediawiki.util.js:r43664-66004
308313 Merged /branches/wmf-deployment/resources/mediawiki.util/mediawiki.util.js:r60970
Index: branches/wmf/1.17wmf1/resources/mediawiki/mediawiki.js
@@ -1004,7 +1004,7 @@
10051005 // Allow calling with an external script or single dependency as a string
10061006 if ( typeof modules === 'string' ) {
10071007 // Support adding arbitrary external scripts
1008 - if ( modules.substr( 0, 7 ) == 'http://' || modules.substr( 0, 8 ) == 'https://' ) {
 1008+ if ( modules.substr( 0, 7 ) === 'http://' || modules.substr( 0, 8 ) === 'https://' || modules.substr( 0, 2 ) === '//' ) {
10091009 if ( type === 'text/css' ) {
10101010 $( 'head' )
10111011 .append( $( '<link rel="stylesheet" type="text/css" />' )
Property changes on: branches/wmf/1.17wmf1/resources/mediawiki/mediawiki.js
___________________________________________________________________
Modified: svn:mergeinfo
10121012 Merged /trunk/phase3/resources/mediawiki/mediawiki.js:r90729,93141,93891,94155,94277,94372

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87099Provisional fix for Bug #28631 to remove artifacts from GIF. This...mah20:18, 28 April 2011
r90729(bug 29567) mw.util.addPortletLink should only wrap link in <span> for "vecto...krinkle19:52, 24 June 2011
r93141Add support for relative-protocol urls in mw.loader.loadkrinkle23:04, 25 July 2011
r93517Adding fix for bug 27427. Fixes unit test. Patch provided by Michael M. throu...krinkle07:39, 30 July 2011
r93891Expand all URLs in e-mail notifications to be full HTTP URLs. This prevents p...catrope15:13, 4 August 2011
r94155(bug 30074) Moving user JS subpages resulted in JS errors because #REDIRECT [...catrope14:23, 10 August 2011
r94277Fix Bug #30322 “SVG metadata is read incorrectly” by applying supplied patchmah19:51, 11 August 2011
r94372Instead of using some hacky regexes, just use wfParseUrl() in WikiMap::getDis...catrope19:19, 12 August 2011

Status & tagging log