diff options
Diffstat (limited to 'plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-queue.php')
-rw-r--r-- | plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-queue.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-queue.php b/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-queue.php index fe80cf90..bf8cf812 100644 --- a/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-queue.php +++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-sync/src/class-queue.php @@ -411,7 +411,7 @@ class Queue { if ( is_wp_error( $is_valid ) ) { // Always delete ids_to_remove even when buffer is no longer checked-out. // They were processed by WP.com so safe to remove from queue. - if ( ! is_null( $ids_to_remove ) ) { + if ( $ids_to_remove !== null ) { $this->delete( $ids_to_remove ); } return $is_valid; @@ -420,7 +420,7 @@ class Queue { $this->delete_checkout_id(); // By default clear all items in the buffer. - if ( is_null( $ids_to_remove ) ) { + if ( $ids_to_remove === null ) { $ids_to_remove = $buffer->get_item_ids(); } @@ -478,6 +478,15 @@ class Queue { } /** + * Checks if the queue is locked. + * + * @return bool + */ + public function is_locked() { + return (bool) $this->get_checkout_id(); + } + + /** * Locks checkouts from the queue * tries to wait up to $timeout seconds for the queue to be empty. * @@ -735,7 +744,7 @@ class Queue { } // TODO: change to strict comparison. - if ( $checkout_id != $buffer->id ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + if ( $checkout_id != $buffer->id ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseNotEqual return new WP_Error( 'buffer_mismatch', 'The buffer you checked in was not checked out' ); } |