Code Duplication    Length = 17-21 lines in 3 locations

geodirectory-functions/privacy/class-geodir-background-process.php 2 locations

@@ 31-47 (lines=17) @@
28
	 *
29
	 * @return bool
30
	 */
31
	protected function is_queue_empty() {
32
		global $wpdb;
33
34
		$table  = $wpdb->options;
35
		$column = 'option_name';
36
37
		if ( is_multisite() ) {
38
			$table  = $wpdb->sitemeta;
39
			$column = 'meta_key';
40
		}
41
42
		$key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
43
44
		$count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$table} WHERE {$column} LIKE %s", $key ) ); // @codingStandardsIgnoreLine.
45
46
		return ! ( $count > 0 );
47
	}
48
49
	/**
50
	 * Get batch.
@@ 183-199 (lines=17) @@
180
	 *
181
	 * @return GeoDir_Background_Process
182
	 */
183
	public function delete_all_batches() {
184
		global $wpdb;
185
186
		$table  = $wpdb->options;
187
		$column = 'option_name';
188
189
		if ( is_multisite() ) {
190
			$table  = $wpdb->sitemeta;
191
			$column = 'meta_key';
192
		}
193
194
		$key = $wpdb->esc_like( $this->identifier . '_batch_' ) . '%';
195
196
		$wpdb->query( $wpdb->prepare( "DELETE FROM {$table} WHERE {$column} LIKE %s", $key ) ); // @codingStandardsIgnoreLine.
197
198
		return $this;
199
	}
200
201
	/**
202
	 * Kill process.

geodirectory-functions/privacy/libraries/wp-background-process.php 1 location

@@ 185-205 (lines=21) @@
182
	 *
183
	 * @return bool
184
	 */
185
	protected function is_queue_empty() {
186
		global $wpdb;
187
188
		$table  = $wpdb->options;
189
		$column = 'option_name';
190
191
		if ( is_multisite() ) {
192
			$table  = $wpdb->sitemeta;
193
			$column = 'meta_key';
194
		}
195
196
		$key = $this->identifier . '_batch_%';
197
198
		$count = $wpdb->get_var( $wpdb->prepare( "
199
			SELECT COUNT(*)
200
			FROM {$table}
201
			WHERE {$column} LIKE %s
202
		", $key ) );
203
204
		return ! ( $count > 0 );
205
	}
206
207
	/**
208
	 * Is process running