SpecialStatistics: Use Config instead of globals
[lhc/web/wiklou.git] / includes / db / Database.php
index 86c2616..62d64eb 100644 (file)
@@ -1490,6 +1490,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
         * @param array $options Query options
         * @param array $join_conds Join conditions
         *
+        *
         * @param string|array $table
         *
         * May be either an array of table names, or a single string holding a table
@@ -3211,7 +3212,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
         * @param DBMasterPos $pos
         * @param int $timeout The maximum number of seconds to wait for
         *   synchronisation
-        * @return int Zzero if the slave was past that position already,
+        * @return int Zero if the slave was past that position already,
         *   greater than zero if we waited for some period of time, less than
         *   zero if we timed out.
         */
@@ -3288,7 +3289,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
        protected function runOnTransactionIdleCallbacks() {
                $autoTrx = $this->getFlag( DBO_TRX ); // automatic begin() enabled?
 
-               $e = null; // last exception
+               $e = $ePrior = null; // last exception
                do { // callbacks may add callbacks :)
                        $callbacks = $this->mTrxIdleCallbacks;
                        $this->mTrxIdleCallbacks = array(); // recursion guard
@@ -3299,6 +3300,10 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
                                        call_user_func( $phpCallback );
                                        $this->setFlag( $autoTrx ? DBO_TRX : 0 ); // restore automatic begin()
                                } catch ( Exception $e ) {
+                                       if ( $ePrior ) {
+                                               MWExceptionHandler::logException( $ePrior );
+                                       }
+                                       $ePrior = $e;
                                }
                        }
                } while ( count( $this->mTrxIdleCallbacks ) );
@@ -3314,7 +3319,7 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
         * @since 1.22
         */
        protected function runOnTransactionPreCommitCallbacks() {
-               $e = null; // last exception
+               $e = $ePrior = null; // last exception
                do { // callbacks may add callbacks :)
                        $callbacks = $this->mTrxPreCommitCallbacks;
                        $this->mTrxPreCommitCallbacks = array(); // recursion guard
@@ -3323,6 +3328,10 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
                                        list( $phpCallback ) = $callback;
                                        call_user_func( $phpCallback );
                                } catch ( Exception $e ) {
+                                       if ( $ePrior ) {
+                                               MWExceptionHandler::logException( $ePrior );
+                                       }
+                                       $ePrior = $e;
                                }
                        }
                } while ( count( $this->mTrxPreCommitCallbacks ) );