File tree Expand file tree Collapse file tree 1 file changed +2
-28
lines changed Expand file tree Collapse file tree 1 file changed +2
-28
lines changed Original file line number Diff line number Diff line change @@ -257,13 +257,7 @@ protected function resumed() {
257257 * @return bool
258258 */
259259 public function is_queued () {
260- $ batch = $ this ->get_batch ();
261-
262- if ( empty ( $ batch ) ) {
263- return false ;
264- }
265-
266- return true ;
260+ return ! $ this ->is_queue_empty ();
267261 }
268262
269263 /**
@@ -349,27 +343,7 @@ public function maybe_handle() {
349343 * @return bool
350344 */
351345 protected function is_queue_empty () {
352- global $ wpdb ;
353-
354- $ table = $ wpdb ->options ;
355- $ column = 'option_name ' ;
356-
357- if ( is_multisite () ) {
358- $ table = $ wpdb ->sitemeta ;
359- $ column = 'meta_key ' ;
360- }
361-
362- $ key = $ wpdb ->esc_like ( $ this ->identifier . '_batch_ ' ) . '% ' ;
363-
364- $ sql = '
365- SELECT COUNT(*)
366- FROM ' . $ table . '
367- WHERE ' . $ column . ' LIKE %s
368- ' ;
369-
370- $ count = $ wpdb ->get_var ( $ wpdb ->prepare ( $ sql , $ key ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
371-
372- return ! ( $ count > 0 );
346+ return empty ( $ this ->get_batch () );
373347 }
374348
375349 /**
You can’t perform that action at this time.
0 commit comments