X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fwatcheditem%2FWatchedItemStore.php;h=a9bba7a9f0ac461cc08ecbfbddb51fd9c1347e0a;hb=1d47891cc3d43bc6b47e30d0b605436c3dac1fc9;hp=f9435a1b0e7947129af2f7f289d1ddc6def1a5c7;hpb=c6ad2554f40f8ebbe9e38ac64ea933076f348729;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/watcheditem/WatchedItemStore.php b/includes/watcheditem/WatchedItemStore.php index f9435a1b0e..a9bba7a9f0 100644 --- a/includes/watcheditem/WatchedItemStore.php +++ b/includes/watcheditem/WatchedItemStore.php @@ -389,7 +389,8 @@ class WatchedItemStore implements WatchedItemStoreInterface, StatsdAwareInterfac $this->uncacheTitlesForUser( $user, $titles ); $dbw = $this->getConnectionRef( DB_MASTER ); - $ticket = $this->lbFactory->getEmptyTransactionTicket( __METHOD__ ); + $ticket = count( $titles ) > $this->updateRowsPerQuery ? + $this->lbFactory->getEmptyTransactionTicket( __METHOD__ ) : null; $affectedRows = 0; // Batch delete items per namespace. @@ -402,7 +403,9 @@ class WatchedItemStore implements WatchedItemStoreInterface, StatsdAwareInterfac 'wl_title' => $toDelete ], __METHOD__ ); $affectedRows += $dbw->affectedRows(); - $this->lbFactory->commitAndWaitForReplication( __METHOD__, $ticket ); + if ( $ticket ) { + $this->lbFactory->commitAndWaitForReplication( __METHOD__, $ticket ); + } } } @@ -714,7 +717,7 @@ class WatchedItemStore implements WatchedItemStoreInterface, StatsdAwareInterfac if ( $this->readOnlyMode->isReadOnly() ) { return false; } - // Only loggedin user can have a watchlist + // Only logged-in user can have a watchlist if ( $user->isAnon() ) { return false; } @@ -741,7 +744,8 @@ class WatchedItemStore implements WatchedItemStoreInterface, StatsdAwareInterfac } $dbw = $this->getConnectionRef( DB_MASTER ); - $ticket = $this->lbFactory->getEmptyTransactionTicket( __METHOD__ ); + $ticket = count( $targets ) > $this->updateRowsPerQuery ? + $this->lbFactory->getEmptyTransactionTicket( __METHOD__ ) : null; $affectedRows = 0; $rowBatches = array_chunk( $rows, $this->updateRowsPerQuery ); foreach ( $rowBatches as $toInsert ) { @@ -749,7 +753,9 @@ class WatchedItemStore implements WatchedItemStoreInterface, StatsdAwareInterfac // if there's already an entry for this page $dbw->insert( 'watchlist', $toInsert, __METHOD__, 'IGNORE' ); $affectedRows += $dbw->affectedRows(); - $this->lbFactory->commitAndWaitForReplication( __METHOD__, $ticket ); + if ( $ticket ) { + $this->lbFactory->commitAndWaitForReplication( __METHOD__, $ticket ); + } } // Update process cache to ensure skin doesn't claim that the current // page is unwatched in the response of action=watch itself (T28292).