BP_Background_Process::get_batch()
Get batch.
Description
Return
(stdClass) Return the first batch from the queue.
Source
File: bp-core/classes/class-bp-background-process.php
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | protected function get_batch() { global $wpdb ; $table = $wpdb ->options; $column = 'option_name' ; $key_column = 'option_id' ; $value_column = 'option_value' ; if ( is_multisite() ) { $table = $wpdb ->sitemeta; $column = 'meta_key' ; $key_column = 'meta_id' ; $value_column = 'meta_value' ; } $key = $wpdb ->esc_like( $this ->identifier . '_batch_' ) . '%' ; $query = $wpdb ->get_row( $wpdb ->prepare( "SELECT * FROM {$table} WHERE {$column} LIKE %s ORDER BY {$key_column} ASC LIMIT 1" , $key ) ); // @codingStandardsIgnoreLine. $batch = new stdClass(); $batch ->key = $query -> $column ; $batch ->data = array_filter ( ( array ) maybe_unserialize( $query -> $value_column ) ); return $batch ; } |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.