From 829c343345263389408ada5abd40a07134660863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Tr=C3=A4nklein?= Date: Mon, 22 Apr 2024 12:58:27 +0200 Subject: [PATCH] feat(uninstall): do not add plugin version to user agent --- includes/features/class-service.php | 6 +++++- includes/models/class-test.php | 1 - includes/services/class-test-service.php | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/features/class-service.php b/includes/features/class-service.php index dc5dbd4..0185139 100644 --- a/includes/features/class-service.php +++ b/includes/features/class-service.php @@ -339,7 +339,11 @@ public static function has_secret() { * @param string $user_agent the user agent. */ public static function set_user_agent( $user_agent ) { - return 'VRTs/' . vrts()->get_plugin_info( 'version' ) . ';' . $user_agent; + if ( function_exists( 'vrts' ) ) { + return 'VRTs/' . vrts()->get_plugin_info( 'version' ) . ';' . $user_agent; + } else { + return $user_agent; + } } /** diff --git a/includes/models/class-test.php b/includes/models/class-test.php index 1fc0d55..d8292ac 100644 --- a/includes/models/class-test.php +++ b/includes/models/class-test.php @@ -743,7 +743,6 @@ public static function reset_base_screenshot( $test_id ) { return $wpdb->update( $table_test, [ - // 'current_alert_id' => null, 'base_screenshot_url' => null, 'base_screenshot_date' => null, 'last_comparison_date' => null, diff --git a/includes/services/class-test-service.php b/includes/services/class-test-service.php index 07f1018..f1349ce 100644 --- a/includes/services/class-test-service.php +++ b/includes/services/class-test-service.php @@ -27,7 +27,6 @@ public function update_test_from_comparison( $alert_id, $test_id, $data ) { $comparison = $data['comparison']; if ( $comparison['screenshot']['image_url'] ?? null ) { // Update test row with new id foreign key and add latest screenshot. - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- It's ok. $update_data = [ 'next_run_date' => $data['next_run_at'] ?? '', 'last_comparison_date' => $comparison['updated_at'], @@ -38,6 +37,7 @@ public function update_test_from_comparison( $alert_id, $test_id, $data ) { if ( $alert_id ) { $update_data['current_alert_id'] = $alert_id; } + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- It's ok. return $wpdb->update( $table_test, $update_data,