Merge "Pass Job success status to teardown callbacks"
[lhc/web/wiklou.git] / includes / user / User.php
index 2af0324..00fc9be 100644 (file)
@@ -1434,11 +1434,11 @@ class User implements IDBAccessObject {
         * protected against race conditions using a compare-and-set (CAS) mechanism
         * based on comparing $this->mTouched with the user_touched field.
         *
-        * @param DatabaseBase $db
-        * @param array $conditions WHERE conditions for use with DatabaseBase::update
-        * @return array WHERE conditions for use with DatabaseBase::update
+        * @param Database $db
+        * @param array $conditions WHERE conditions for use with Database::update
+        * @return array WHERE conditions for use with Database::update
         */
-       protected function makeUpdateConditions( DatabaseBase $db, array $conditions ) {
+       protected function makeUpdateConditions( Database $db, array $conditions ) {
                if ( $this->mTouched ) {
                        // CAS check: only update if the row wasn't changed sicne it was loaded.
                        $conditions['user_touched'] = $db->timestamp( $this->mTouched );
@@ -1802,12 +1802,16 @@ class User implements IDBAccessObject {
                        return false;
                }
 
+               $limits = array_merge(
+                       [ '&can-bypass' => true ],
+                       $wgRateLimits[$action]
+               );
+
                // Some groups shouldn't trigger the ping limiter, ever
-               if ( !$this->isPingLimitable() ) {
+               if ( $limits['&can-bypass'] && !$this->isPingLimitable() ) {
                        return false;
                }
 
-               $limits = $wgRateLimits[$action];
                $keys = [];
                $id = $this->getId();
                $userLimit = false;
@@ -2358,7 +2362,8 @@ class User implements IDBAccessObject {
                        wfGetDB( DB_MASTER )->onTransactionPreCommitOrIdle(
                                function() use ( $cache, $key ) {
                                        $cache->delete( $key );
-                               }
+                               },
+                               __METHOD__
                        );
                }
        }
@@ -4927,9 +4932,12 @@ class User implements IDBAccessObject {
         * Deferred version of incEditCountImmediate()
         */
        public function incEditCount() {
-               wfGetDB( DB_MASTER )->onTransactionPreCommitOrIdle( function() {
-                       $this->incEditCountImmediate();
-               } );
+               wfGetDB( DB_MASTER )->onTransactionPreCommitOrIdle(
+                       function () {
+                               $this->incEditCountImmediate();
+                       },
+                       __METHOD__
+               );
        }
 
        /**