r85256 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85255‎ | r85256 | r85257 >
Date:14:13, 3 April 2011
Author:catrope
Status:resolved
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.17wmf1/RELEASE-NOTES (modified) (history)
  • /branches/wmf/1.17wmf1/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js (modified) (history)
  • /branches/wmf/1.17wmf1/includes/Article.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/DefaultSettings.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/Title.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/WebStart.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/Wiki.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/api/ApiQueryImageInfo.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/parser/CoreParserFunctions.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/resourceloader/ResourceLoader.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/specials/SpecialFilepath.php (modified) (history)
  • /branches/wmf/1.17wmf1/includes/specials/SpecialIpblocklist.php (modified) (history)
  • /branches/wmf/1.17wmf1/resources/mediawiki/mediawiki.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js
@@ -167,7 +167,7 @@
168168 $(this).css( 'white-space', 'nowrap' );
169169 if ( wrapper.width() <= $(this).get(0).scrollWidth ) {
170170 var thisWidth = $(this).data( 'thisWidth' ) ? $(this).data( 'thisWidth' ) : 0;
171 - thisWidth = Math.max( $(this).get(0).scrollWidth, thisWidth );
 171+ thisWidth = Math.max( $(this).get(0).width, thisWidth );
172172 $(this).width( thisWidth );
173173 $(this).data( 'thisWidth', thisWidth );
174174 var wrapperWidth = $(this).data( 'wrapperWidth' ) ? $(this).data( 'wrapperWidth' ) : 0;
Index: branches/wmf/1.17wmf1/includes/Article.php
@@ -1385,7 +1385,7 @@
13861386 if ( !$this->hasViewableContent() ) {
13871387 // If there's no backing content, send a 404 Not Found
13881388 // for better machine handling of broken links.
1389 - $wgRequest->response()->header( "HTTP/1.x 404 Not Found" );
 1389+ $wgRequest->response()->header( "HTTP/1.1 404 Not Found" );
13901390 }
13911391
13921392 $wgOut->addWikiText( $text );
Property changes on: branches/wmf/1.17wmf1/includes/Article.php
___________________________________________________________________
Modified: svn:mergeinfo
13931393 Merged /trunk/phase3/includes/Article.php:r80813,80815,83798,84459,84729,84820,84985,85140,85152,85194
Index: branches/wmf/1.17wmf1/includes/parser/CoreParserFunctions.php
@@ -616,11 +616,41 @@
617617 '</span>' );
618618 }
619619
620 - public static function filepath( $parser, $name='', $option='' ) {
 620+ // Usage {{filepath|300}}, {{filepath|nowiki}}, {{filepath|nowiki|300}} or {{filepath|300|nowiki}}
 621+ public static function filepath( $parser, $name='', $argA='', $argB='' ) {
621622 $file = wfFindFile( $name );
622 - if( $file ) {
623 - $url = $file->getFullUrl();
624 - if( $option == 'nowiki' ) {
 623+ $size = '';
 624+ $argA_int = intval( $argA );
 625+ $argB_int = intval( $argB );
 626+
 627+ if ( $argB_int > 0 ) {
 628+ // {{filepath: | option | size }}
 629+ $size = $argB_int;
 630+ $option = $argA;
 631+
 632+ } elseif ( $argA_int > 0 ) {
 633+ // {{filepath: | size [|option] }}
 634+ $size = $argA_int;
 635+ $option = $argB;
 636+
 637+ } else {
 638+ // {{filepath: [|option] }}
 639+ $option = $argA;
 640+ }
 641+
 642+ if ( $file ) {
 643+ $url = $file->getUrl();
 644+
 645+ // If a size is requested...
 646+ if ( is_integer( $size ) ) {
 647+ $mto = $file->transform( array( 'width' => $size ) );
 648+ // ... and we can
 649+ if ( $mto && !$mto->isError() ) {
 650+ // ... change the URL to point to a thumbnail.
 651+ $url = wfExpandUrl( $mto->getUrl() );
 652+ }
 653+ }
 654+ if ( $option == 'nowiki' ) {
625655 return array( $url, 'nowiki' => true );
626656 }
627657 return $url;
Index: branches/wmf/1.17wmf1/includes/api/ApiQueryImageInfo.php
@@ -298,9 +298,11 @@
299299 $vals['thumbheight'] = intval( $file->getHeight() );
300300 }
301301
302 - if ( isset( $prop['thumbmime'] ) ) {
303 - $thumbFile = UnregisteredLocalFile::newFromPath( $mto->getPath(), false );
304 - $vals['thumbmime'] = $thumbFile->getMimeType();
 302+ if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
 303+ list( $ext, $mime ) = $file->getHandler()->getThumbType(
 304+ substr( $mto->getPath(), strrpos( $mto->getPath(), '.' ) + 1 ),
 305+ $file->getMimeType(), $thumbParams );
 306+ $vals['thumbmime'] = $mime;
305307 }
306308 } else if ( $mto && $mto->isError() ) {
307309 $vals['thumberror'] = $mto->toText();
Property changes on: branches/wmf/1.17wmf1/includes/api/ApiQueryImageInfo.php
___________________________________________________________________
Modified: svn:mergeinfo
308310 Merged /trunk/phase3/includes/api/ApiQueryImageInfo.php:r80813,80815,83798,84459,84729,84820,84985,85140,85152,85194
Index: branches/wmf/1.17wmf1/includes/resourceloader/ResourceLoader.php
@@ -359,9 +359,9 @@
360360 wfProfileOut( __METHOD__.'-getModifiedTime' );
361361
362362 if ( $context->getOnly() === 'styles' ) {
363 - header( 'Content-Type: text/css' );
 363+ header( 'Content-Type: text/css; charset=utf-8' );
364364 } else {
365 - header( 'Content-Type: text/javascript' );
 365+ header( 'Content-Type: text/javascript; charset=utf-8' );
366366 }
367367 header( 'Last-Modified: ' . wfTimestamp( TS_RFC2822, $mtime ) );
368368 if ( $context->getDebug() ) {
Property changes on: branches/wmf/1.17wmf1/includes/resourceloader/ResourceLoader.php
___________________________________________________________________
Modified: svn:mergeinfo
369369 Merged /trunk/phase3/includes/resourceloader/ResourceLoader.php:r80813,80815,83798,84459,84729,84820,84985,85140,85152,85194
Index: branches/wmf/1.17wmf1/includes/WebStart.php
@@ -34,7 +34,7 @@
3535 );
3636 foreach ( $_REQUEST as $name => $value ) {
3737 if( in_array( $name, $verboten ) ) {
38 - header( "HTTP/1.x 500 Internal Server Error" );
 38+ header( "HTTP/1.1 500 Internal Server Error" );
3939 echo "register_globals security paranoia: trying to overwrite superglobals, aborting.";
4040 die( -1 );
4141 }
Index: branches/wmf/1.17wmf1/includes/Wiki.php
@@ -197,7 +197,8 @@
198198 }
199199 /* Check for a redirect loop */
200200 if( !preg_match( '/^' . preg_quote( $this->getVal('Server'), '/' ) . '/', $url ) && $title->isLocal() ) {
201 - $output->redirect( $url );
 201+ // 301 so google et al report the target as the actual url.
 202+ $output->redirect( $url, 301 );
202203 } else {
203204 $title = SpecialPage::getTitleFor( 'Badtitle' );
204205 $output->setTitle( $title ); // bug 21456
Property changes on: branches/wmf/1.17wmf1/includes/Wiki.php
___________________________________________________________________
Modified: svn:mergeinfo
205206 Merged /trunk/phase3/includes/Wiki.php:r80813,80815,83798,84459,84729,84820,84985,85140,85152,85194
Index: branches/wmf/1.17wmf1/includes/Title.php
@@ -3081,7 +3081,8 @@
30823082 }
30833083 }
30843084
3085 - $pageid = $this->getArticleID();
 3085+ $dbw->begin(); # If $file was a LocalFile, its transaction would have closed our own.
 3086+ $pageid = $this->getArticleID( GAID_FOR_UPDATE );
30863087 $protected = $this->isProtected();
30873088 if ( $nt->exists() ) {
30883089 $err = $this->moveOverExistingRedirect( $nt, $reason, $createRedirect );
@@ -3092,6 +3093,8 @@
30933094 }
30943095
30953096 if ( is_array( $err ) ) {
 3097+ # FIXME: What about the File we have already moved?
 3098+ $dbw->rollback();
30963099 return $err;
30973100 }
30983101 $redirid = $this->getArticleID();
@@ -3159,6 +3162,8 @@
31603163 $u = new SearchUpdate( $redirid, $this->getPrefixedDBkey(), '' );
31613164 $u->doUpdate();
31623165
 3166+ $dbw->commit();
 3167+
31633168 # Update site_stats
31643169 if ( $this->isContentPage() && !$nt->isContentPage() ) {
31653170 # No longer a content page
Property changes on: branches/wmf/1.17wmf1/includes/Title.php
___________________________________________________________________
Modified: svn:mergeinfo
31663171 Merged /trunk/phase3/includes/Title.php:r80813,80815,83798,84459,84729,84820,84985,85140,85152,85194
Index: branches/wmf/1.17wmf1/includes/DefaultSettings.php
@@ -5256,7 +5256,9 @@
52575257
52585258 /**
52595259 * Disable redirects to special pages and interwiki redirects, which use a 302
5260 - * and have no "redirected from" link.
 5260+ * and have no "redirected from" link. Note this is only for articles with #Redirect
 5261+ * in them. URL's containing a local interwiki prefix (or a non-canonical special
 5262+ * page name) are still hard redirected regardless of this setting.
52615263 */
52625264 $wgDisableHardRedirects = false;
52635265
Property changes on: branches/wmf/1.17wmf1/includes/DefaultSettings.php
___________________________________________________________________
Modified: svn:mergeinfo
52645266 Merged /trunk/phase3/includes/DefaultSettings.php:r80813,80815,83798,84459,84729,84820,84985,85140,85152,85194
Index: branches/wmf/1.17wmf1/includes/specials/SpecialIpblocklist.php
@@ -210,6 +210,9 @@
211211 }
212212 $ip = $block->getRedactedName();
213213 } else {
 214+ # FIXME: do proper sanitisation/cleanup here
 215+ $ip = str_replace( '_', ' ', $ip );
 216+
214217 $block = Block::newFromDB( $ip );
215218 if ( !$block ) {
216219 return array( 'ipb_cant_unblock', htmlspecialchars( $id ) );
Index: branches/wmf/1.17wmf1/includes/specials/SpecialFilepath.php
@@ -50,9 +50,13 @@
5151 $url = $file->getURL();
5252 $width = $wgRequest->getInt( 'width', -1 );
5353 $height = $wgRequest->getInt( 'height', -1 );
 54+
 55+ // If a width is requested...
5456 if ( $width != -1 ) {
5557 $mto = $file->transform( array( 'width' => $width, 'height' => $height ) );
 58+ // ... and we can
5659 if ( $mto && !$mto->isError() ) {
 60+ // ... change the URL to point to a thumbnail.
5761 $url = $mto->getURL();
5862 }
5963 }
Index: branches/wmf/1.17wmf1/RELEASE-NOTES
@@ -495,12 +495,26 @@
496496 exist.
497497 * (bug 28034) uploading file to local wiki when file exists on shared repository
498498 (commons) gives spurious info in the warning message
499 -
500 -=== API changes in 1.17 ===
501 -* BREAKING CHANGE: action=patrol now requires POST
502 -* BREAKING CHANGE: patrol token is no longer the same as edit token
503 -* BREAKING CHANGE: Session keys returned by ApiUpload are now strings instead of integers
504 -* (bug 24650) Fix API to work with categorylinks changes
 499+* Usernames get lost when selecting different sorts on Special:listfiles
 500+* (bug 14005) editing section 0 of an existing but empty page gives no such
 501+ section error
 502+* (bug 26939) Installer does not set $wgMetaNamespace
 503+* (bug 28166) UploadBase assumes that 'edit' and 'upload' rights are not per
 504+ page restrictions
 505+* Make truncate function automatically consider length of '...' string,
 506+ since length can vary by localization.
 507+* (bug 28242) Make redirects generated by urls containing a local interwiki
 508+ prefix be a 301 instead of a 302.
 509+
 510+=== API changes in 1.18 ===
 511+* (bug 26339) Throw warning when truncating an overlarge API result
 512+* (bug 14869) Add API module for accessing QueryPage-based special pages
 513+* (bug 14020) API for Special:Unwatchedpages
 514+* (bug 24287) Wrap API Help output at 100 characters
 515+* Add a realname uiprop option to query=userinfo so a user's realname can be
 516+ extracted
 517+* Add a &watchuser option to ApiBlock
 518+* (bug 26541) Generator-ise ApiQueryRecentChanges
505519 * action=parse now correctly returns an error for nonexistent pages
506520 * (bug 27201) Special:WhatLinksHere output no longer contains duplicate IDs
507521 * (bug 27479) API error when using both prop=pageprops and
Property changes on: branches/wmf/1.17wmf1/RELEASE-NOTES
___________________________________________________________________
Modified: svn:mergeinfo
508522 Merged /trunk/phase3/RELEASE-NOTES:r80813,80815,83798,84459,84729,84820,84985,85140,85152,85194
Index: branches/wmf/1.17wmf1/resources/mediawiki/mediawiki.js
@@ -622,8 +622,12 @@
623623 }
624624 }
625625 } catch ( e ) {
626 - mediaWiki.log( 'Exception thrown by ' + module + ': ' + e.message );
627 - mediaWiki.log( e );
 626+ // This needs to NOT use mw.log because these errors are common in production mode
 627+ // and not in debug mode, such as when a symbol that should be global isn't exported
 628+ if ( window.console && typeof window.console.log === 'function' ) {
 629+ console.log( _fn + 'Exception thrown by ' + module + ': ' + e.message );
 630+ console.log( e );
 631+ }
628632 registry[module].state = 'error';
629633 // Run error callbacks of jobs affected by this condition
630634 for ( var j = 0; j < jobs.length; j++ ) {
Property changes on: branches/wmf/1.17wmf1/resources/mediawiki/mediawiki.js
___________________________________________________________________
Modified: svn:mergeinfo
631635 Merged /trunk/phase3/resources/mediawiki/mediawiki.js:r80813,80815,83798,84459,84729,84820,84985,85140,85152,85194

Follow-up revisions

RevisionCommit summaryAuthorDate
r856141.17wmf1: Fix botched merge of r84985 in r85256, was causing JS errorscatrope11:06, 7 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80813Bug 26870 - add width/height param to {{filepath:}}...krinkle13:09, 23 January 2011
r80815Follow-up per r80813 CRkrinkle14:34, 23 January 2011
r83798(bug 28017) Unblocking a user with a space in their name does not work. This...happy-melon23:54, 12 March 2011
r84459(Bug 26223) Concurrently moving an article to different titles leaks a redire...platonides16:46, 21 March 2011
r84729Fixes Bug #28214 - When page not found, sends malformed HTTP/1.x instead of H...mah03:36, 25 March 2011
r84820(bug 28242) Make url's of the form http://mediawiki.org/wiki/w:Somewhere_on_p......bawolff21:06, 26 March 2011
r84921Because this element has margins, the scrollWidth will be larger by definitio...hartman21:11, 28 March 2011
r84985Swtiched to using console.log if present so that when errors occur inside of ...tparscal22:08, 29 March 2011
r85140Fixed issue where reference error can be thrown - response to comments on r84985tparscal18:05, 1 April 2011
r85152Added charset property to HTTP Content-Type fields when serving CSS and JavaS...tparscal20:48, 1 April 2011
r85194Get the thumbmime from the handler instead of guessing it with UnregisteredLo...btongminh14:49, 2 April 2011

Status & tagging log