Merge "(bug 4220) dump schema get unique contraints on id"
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 25 May 2012 22:39:30 +0000 (22:39 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 25 May 2012 22:39:30 +0000 (22:39 +0000)
includes/ImagePage.php
includes/Title.php
includes/User.php
includes/api/ApiFormatXml.php
includes/api/ApiQueryUsers.php
includes/specials/SpecialPasswordReset.php
resources/jquery/jquery.byteLimit.js
tests/parser/parserTests.txt

index 3fbbcba..3aeb70a 100644 (file)
@@ -346,18 +346,30 @@ class ImagePage extends Article {
                                                # Note that $height <= $maxHeight now, but might not be identical
                                                # because of rounding.
                                        }
-                                       $msgbig  = wfMsgHtml( 'show-big-image' );
+                                       $msgbig = wfMsgHtml( 'show-big-image' );
+                                       if ( $this->displayImg->getRepo()->canTransformVia404() ) {
+                                               $thumbSizes = $wgImageLimits;
+                                       } else {
+                                               # Creating thumb links triggers thumbnail generation.
+                                               # Just generate the thumb for the current users prefs.
+                                               $thumbOption = $user->getOption( 'thumbsize' );
+                                               $thumbSizes = array( isset( $wgImageLimits[$thumbOption] )
+                                                       ? $wgImageLimits[$thumbOption]
+                                                       : $wgImageLimits[User::getDefaultOption( 'thumbsize' )] );
+                                       }
+                                       # Generate thumbnails or thumbnail links as needed...
                                        $otherSizes = array();
-                                       foreach ( $wgImageLimits as $size ) {
-                                               if ( $size[0] < $width_orig && $size[1] < $height_orig &&
-                                                               $size[0] != $width && $size[1] != $height ) {
+                                       foreach ( $thumbSizes as $size ) {
+                                               if ( $size[0] < $width_orig && $size[1] < $height_orig
+                                                       && $size[0] != $width && $size[1] != $height )
+                                               {
                                                        $otherSizes[] = $this->makeSizeLink( $params, $size[0], $size[1] );
                                                }
                                        }
                                        $msgsmall = wfMessage( 'show-big-image-preview' )->
                                                rawParams( $this->makeSizeLink( $params, $width, $height ) )->
                                                parse();
-                                       if ( count( $otherSizes ) && $this->displayImg->getRepo()->canTransformVia404() ) {
+                                       if ( count( $otherSizes ) ) {
                                                $msgsmall .= ' ' .
                                                Html::rawElement( 'span', array( 'class' => 'mw-filepage-other-resolutions' ),
                                                        wfMessage( 'show-big-image-other' )->rawParams( $lang->pipeList( $otherSizes ) )->
index 807fcc1..481f480 100644 (file)
@@ -209,7 +209,15 @@ class Title {
         */
        public static function newFromID( $id, $flags = 0 ) {
                $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
-               $row = $db->selectRow( 'page', '*', array( 'page_id' => $id ), __METHOD__ );
+               $row = $db->selectRow(
+                       'page',
+                       array(
+                               'page_namespace', 'page_title', 'page_id',
+                               'page_len', 'page_is_redirect', 'page_latest',
+                       ),
+                       array( 'page_id' => $id ),
+                       __METHOD__
+               );
                if ( $row !== false ) {
                        $title = Title::newFromRow( $row );
                } else {
@@ -3970,7 +3978,7 @@ class Title {
                $pageId = $this->getArticleID( $flags );
                if ( $pageId ) {
                        $db = ( $flags & self::GAID_FOR_UPDATE ) ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
-                       $row = $db->selectRow( 'revision', '*',
+                       $row = $db->selectRow( 'revision', Revision::selectFields(),
                                array( 'rev_page' => $pageId ),
                                __METHOD__,
                                array( 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 1 )
index 5de4b2c..84f02af 100644 (file)
@@ -1028,7 +1028,7 @@ class User {
                }
 
                $dbr = wfGetDB( DB_MASTER );
-               $s = $dbr->selectRow( 'user', '*', array( 'user_id' => $this->mId ), __METHOD__ );
+               $s = $dbr->selectRow( 'user', self::selectFields(), array( 'user_id' => $this->mId ), __METHOD__ );
 
                wfRunHooks( 'UserLoadFromDatabase', array( $this, &$s ) );
 
@@ -4018,7 +4018,7 @@ class User {
 
                        $res = $dbr->select(
                                'user_properties',
-                               '*',
+                               array( 'up_property', 'up_value' ),
                                array( 'up_user' => $this->getId() ),
                                __METHOD__
                        );
@@ -4141,4 +4141,28 @@ class User {
 
                return $ret;
        }
+
+       /**
+        * Return the list of user fields that should be selected to create
+        * a new user object.
+        * @return array
+        */
+       public static function selectFields() {
+               return array(
+                       'user_id',
+                       'user_name',
+                       'user_real_name',
+                       'user_password',
+                       'user_newpassword',
+                       'user_newpass_time',
+                       'user_email',
+                       'user_touched',
+                       'user_token',
+                       'user_email_authenticated',
+                       'user_email_token',
+                       'user_email_token_expires',
+                       'user_registration',
+                       'user_editcount',
+               );
+       }
 }
index 8f4abc1..ef2c54f 100644 (file)
@@ -215,7 +215,8 @@ class ApiFormatXml extends ApiFormatBase {
        public function getParamDescription() {
                return array(
                        'xmldoublequote' => 'If specified, double quotes all attributes and content',
-                       'xslt' => 'If specified, adds <xslt> as stylesheet',
+                       'xslt' => 'If specified, adds <xslt> as stylesheet. This should be a wiki page '
+                               . 'in the MediaWiki namespace whose page name ends with ".xsl"',
                        'includexmlnamespace' => 'If specified, adds an XML namespace'
                );
        }
index a07ee7f..83872a5 100644 (file)
@@ -107,7 +107,7 @@ class ApiQueryUsers extends ApiQueryBase {
 
                if ( count( $goodNames ) ) {
                        $this->addTables( 'user' );
-                       $this->addFields( '*' );
+                       $this->addFields( User::selectFields() );
                        $this->addWhereFld( 'user_name', $goodNames );
 
                        if ( isset( $this->prop['groups'] ) || isset( $this->prop['rights'] ) ) {
index f140546..51520c8 100644 (file)
@@ -154,7 +154,7 @@ class SpecialPasswordReset extends FormSpecialPage {
                        $method = 'email';
                        $res = wfGetDB( DB_SLAVE )->select(
                                'user',
-                               '*',
+                               User::selectFields(),
                                array( 'user_email' => $data['Email'] ),
                                __METHOD__
                        );
index 3c0d7e5..45df39a 100644 (file)
@@ -8,7 +8,7 @@
 
        /**
         * Enforces a byte limit to a textbox, so that UTF-8 entries are counted as well, when, for example,
-        * a databae field has a byte limit rather than a character limit.
+        * a database field has a byte limit rather than a character limit.
         * Plugin rationale: Browser has native maxlength for number of characters, this plugin exists to
         * limit number of bytes instead.
         *
index 3a8a778..bcdbe8c 100644 (file)
@@ -640,6 +640,17 @@ Definition and unordered list using wiki syntax nested in unordered list using h
 
 !! end
 
+!! test
+Definition list with empty definition and following paragraph
+!! input
+; term:
+Paragraph text
+!! result
+<dl><dt> term</dt><dd>
+</dd></dl>
+<p>Paragraph text
+</p>
+!! end
 
 ###
 ### External links