Merge "(bug 42598) Database: fname was not logged for BEGIN/COMMIT."
authorNikerabbit <niklas.laxstrom@gmail.com>
Sun, 2 Dec 2012 08:45:00 +0000 (08:45 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 2 Dec 2012 08:45:00 +0000 (08:45 +0000)
includes/AjaxResponse.php
includes/OutputPage.php
includes/WikiPage.php
includes/filerepo/file/LocalFile.php
includes/job/JobQueueDB.php
includes/upload/UploadFromChunks.php
maintenance/cleanupPreferences.php
maintenance/convertUserOptions.php
maintenance/deleteOrphanedRevisions.php
resources/mediawiki/mediawiki.Uri.js
tests/testHelpers.inc

index 6bf94cc..23c31bf 100644 (file)
@@ -204,7 +204,7 @@ class AjaxResponse {
 
        /**
         * checkLastModified tells the client to use the client-cached response if
-        * possible. If sucessful, the AjaxResponse is disabled so that
+        * possible. If successful, the AjaxResponse is disabled so that
         * any future call to AjaxResponse::printText() have no effect.
         *
         * @param $timestamp string
index 8399a8c..7649b23 100644 (file)
@@ -611,7 +611,7 @@ class OutputPage extends ContextSource {
 
        /**
         * checkLastModified tells the client to use the client-cached page if
-        * possible. If sucessful, the OutputPage is disabled so that
+        * possible. If successful, the OutputPage is disabled so that
         * any future call to OutputPage->output() have no effect.
         *
         * Side effect: sets mLastModified for Last-Modified header
index a4bc6ee..0b588cb 100644 (file)
@@ -1736,7 +1736,7 @@ class WikiPage extends Page implements IDBAccessObject {
                                $status->merge( $prepStatus );
 
                                if ( !$status->isOK() ) {
-                                       $dbw->rollback();
+                                       $dbw->rollback( __METHOD__ );
 
                                        wfProfileOut( __METHOD__ );
                                        return $status;
@@ -1815,7 +1815,7 @@ class WikiPage extends Page implements IDBAccessObject {
                        $status->merge( $prepStatus );
 
                        if ( !$status->isOK() ) {
-                               $dbw->rollback();
+                               $dbw->rollback( __METHOD__ );
 
                                wfProfileOut( __METHOD__ );
                                return $status;
index e8f2540..3525594 100644 (file)
@@ -1213,13 +1213,13 @@ class LocalFile extends File {
                        $status = $wikiPage->doEditContent( $content, $comment, EDIT_NEW | EDIT_SUPPRESS_RC, false, $user );
 
                        if ( isset( $status->value['revision'] ) ) { // XXX; doEdit() uses a transaction
-                               $dbw->begin();
+                               $dbw->begin( __METHOD__ );
                                $dbw->update( 'logging',
                                        array( 'log_page' => $status->value['revision']->getPage() ),
                                        array( 'log_id' => $logId ),
                                        __METHOD__
                                );
-                               $dbw->commit(); // commit before anything bad can happen
+                               $dbw->commit( __METHOD__ ); // commit before anything bad can happen
                        }
                }
                wfProfileOut( __METHOD__ . '-edit' );
index 0c01db7..80bc6d5 100644 (file)
@@ -77,7 +77,7 @@ class JobQueueDB extends JobQueue {
 
                                $autoTrx = $dbw->getFlag( DBO_TRX ); // automatic begin() enabled?
                                if ( $atomic ) {
-                                       $dbw->begin(); // wrap all the job additions in one transaction
+                                       $dbw->begin( __METHOD__ ); // wrap all the job additions in one transaction
                                } else {
                                        $dbw->clearFlag( DBO_TRX ); // make each query its own transaction
                                }
@@ -87,14 +87,14 @@ class JobQueueDB extends JobQueue {
                                        }
                                } catch ( DBError $e ) {
                                        if ( $atomic ) {
-                                               $dbw->rollback();
+                                               $dbw->rollback( __METHOD__ );
                                        } else {
                                                $dbw->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore automatic begin()
                                        }
                                        throw $e;
                                }
                                if ( $atomic ) {
-                                       $dbw->commit();
+                                       $dbw->commit( __METHOD__ );
                                } else {
                                        $dbw->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore automatic begin()
                                }
index e923c20..0a13683 100644 (file)
@@ -212,7 +212,7 @@ class UploadFromChunks extends UploadFromFile {
                $dbw = $this->repo->getMasterDb();
                // Use a quick transaction since we will upload the full temp file into shared
                // storage, which takes time for large files. We don't want to hold locks then.
-               $dbw->begin();
+               $dbw->begin( __METHOD__ );
                $dbw->update(
                        'uploadstash',
                        array(
@@ -223,7 +223,7 @@ class UploadFromChunks extends UploadFromFile {
                        array( 'us_key' => $this->mFileKey ),
                        __METHOD__
                );
-               $dbw->commit();
+               $dbw->commit( __METHOD__ );
        }
 
        /**
index 3539689..c0a526b 100644 (file)
@@ -35,7 +35,7 @@ class CleanupPreferences extends Maintenance {
                global $wgHiddenPrefs;
 
                $dbw = wfGetDB( DB_MASTER );
-               $dbw->begin();
+               $dbw->begin( __METHOD__ );
                foreach( $wgHiddenPrefs as $item ) {
                        $dbw->delete(
                                'user_properties',
@@ -43,7 +43,7 @@ class CleanupPreferences extends Maintenance {
                                __METHOD__
                        );
                };
-               $dbw->commit();
+               $dbw->commit( __METHOD__ );
                $this->output( "Finished!\n" );
        }
 }
index 7c9ca26..e2223e1 100644 (file)
@@ -56,7 +56,7 @@ class ConvertUserOptions extends Maintenance {
                                array( 'LIMIT' => 50, 'FOR UPDATE' )
                        );
                        $id = $this->convertOptionBatch( $res, $dbw );
-                       $dbw->commit();
+                       $dbw->commit( __METHOD__ );
 
                        wfWaitForSlaves();
 
index 5dc7567..dcbf739 100644 (file)
@@ -61,7 +61,7 @@ class DeleteOrphanedRevisions extends Maintenance {
 
                # Nothing to do?
                if ( $report || $count == 0 ) {
-                       $dbw->commit();
+                       $dbw->commit( __METHOD__ );
                        exit( 0 );
                }
 
index bd12b21..f85dec8 100644 (file)
        /**
         * Function that's useful when constructing the URI string -- we frequently encounter the pattern of
         * having to add something to the URI as we go, but only if it's present, and to include a character before or after if so.
-        * @param {String} to prepend, if value not empty
-        * @param {String} value to include, if not empty
-        * @param {String} to append, if value not empty
-        * @param {Boolean} raw -- if true, do not URI encode
-        * @return {String}
+        * @param {string|undefined} pre To prepend.
+        * @param {string} val To include.
+        * @param {string} post To append.
+        * @param {boolean} raw If true, val will not be encoded.
+        * @return {string} Result.
         */
        function cat( pre, val, post, raw ) {
                if ( val === undefined || val === null || val === '' ) {
                /**
                 * Constructs URI object. Throws error if arguments are illegal/impossible, or otherwise don't parse.
                 * @constructor
-                * @param {Object|String} URI string, or an Object with appropriate properties (especially another URI object to clone).
+                * @param {Object|string} uri URI string, or an Object with appropriate properties (especially another URI object to clone).
                 * Object must have non-blank 'protocol', 'host', and 'path' properties.
-                * This parameter is optional. If omitted (or set to undefined, null or empty string), then an object will be created
-                * for the default uri of this constructor (e.g. document.location for mw.Uri in MediaWiki core).
-                * @param {Object|Boolean} Object with options, or (backwards compatibility) a boolean for strictMode
-                * - strictMode {Boolean} Trigger strict mode parsing of the url. Default: false
-                * - overrideKeys {Boolean} Wether to let duplicate query parameters override eachother (true) or automagically
-                *   convert to an array (false, default).
+                *  This parameter is optional. If omitted (or set to undefined, null or empty string), then an object will be created
+                *  for the default uri of this constructor (e.g. document.location for mw.Uri in MediaWiki core).
+                * @param {Object|boolean} Object with options, or (backwards compatibility) a boolean for strictMode
+                *  - {boolean} strictMode Trigger strict mode parsing of the url. Default: false
+                *  - {boolean} overrideKeys Wether to let duplicate query parameters override eachother (true) or automagically
+                *     convert to an array (false, default).
                 */
                function Uri( uri, options ) {
                        options = typeof options === 'object' ? options : { strictMode: !!options };
                        }
                        if ( this.path && this.path.charAt( 0 ) !== '/' ) {
                                // A real relative URL, relative to defaultUri.path. We can't really handle that since we cannot
-                               // figure out whether the last path compoennt of defaultUri.path is a directory or a file.
+                               // figure out whether the last path component of defaultUri.path is a directory or a file.
                                throw new Error( 'Bad constructor arguments' );
                        }
                        if ( !( this.protocol && this.host && this.path ) ) {
                /**
                 * Standard encodeURIComponent, with extra stuff to make all browsers work similarly and more compliant with RFC 3986
                 * Similar to rawurlencode from PHP and our JS library mw.util.rawurlencode, but we also replace space with a +
-                * @param {String} string
-                * @return {String} encoded for URI
+                * @param {string} s String to encode.
+                * @return {string} Encoded string for URI.
                 */
                Uri.encode = function ( s ) {
                        return encodeURIComponent( s )
                };
 
                /**
-                * Standard decodeURIComponent, with '+' to space
-                * @param {String} string encoded for URI
-                * @return {String} decoded string
+                * Standard decodeURIComponent, with '+' to space.
+                * @param {string} s String encoded for URI.
+                * @return {string} Decoded string.
                 */
                Uri.decode = function ( s ) {
                        return decodeURIComponent( s.replace( /\+/g, '%20' ) );
 
                        /**
                         * Parse a string and set our properties accordingly.
-                        * @param {String} URI
+                        * @param {string} str URI
                         * @param {Object} options
-                        * @return {Boolean} success
+                        * @return {boolean} Success.
                         */
                        parse: function ( str, options ) {
                                var q,
 
                        /**
                         * Returns user and password portion of a URI.
-                        * @return {String}
+                        * @return {string}
                         */
                        getUserInfo: function () {
                                return cat( '', this.user, cat( ':', this.password, '' ) );
 
                        /**
                         * Gets host and port portion of a URI.
-                        * @return {String}
+                        * @return {string}
                         */
                        getHostPort: function () {
                                return this.host + cat( ':', this.port, '' );
                        /**
                         * Returns the userInfo and host and port portion of the URI.
                         * In most real-world URLs, this is simply the hostname, but it is more general.
-                        * @return {String}
+                        * @return {string}
                         */
                        getAuthority: function () {
                                return cat( '', this.getUserInfo(), '@' ) + this.getHostPort();
                        /**
                         * Returns the query arguments of the URL, encoded into a string
                         * Does not preserve the order of arguments passed into the URI. Does handle escaping.
-                        * @return {String}
+                        * @return {string}
                         */
                        getQueryString: function () {
                                var args = [];
 
                        /**
                         * Returns everything after the authority section of the URI
-                        * @return {String}
+                        * @return {string}
                         */
                        getRelativePath: function () {
                                return this.path + cat( '?', this.getQueryString(), '', true ) + cat( '#', this.fragment, '' );
 
                        /**
                         * Gets the entire URI string. May not be precisely the same as input due to order of query arguments.
-                        * @return {String} the URI string
+                        * @return {string} The URI string.
                         */
                        toString: function () {
                                return this.protocol + '://' + this.getAuthority() + this.getRelativePath();
index 4b2e923..f1eb833 100644 (file)
@@ -275,7 +275,7 @@ class DbTestRecorder extends DbTestPreviewer  {
         * and all that fun stuff
         */
        function start() {
-               $this->db->begin();
+               $this->db->begin( __METHOD__ );
 
                if ( ! $this->db->tableExists( 'testrun' )
                        || ! $this->db->tableExists( 'testitem' ) )