Skip to content

Commit

Permalink
feat(uninstall): do not add plugin version to user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
domtra committed Apr 22, 2024
1 parent be23860 commit 829c343
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion includes/features/class-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

/**
Expand Down
1 change: 0 additions & 1 deletion includes/models/class-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion includes/services/class-test-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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,
Expand Down

0 comments on commit 829c343

Please sign in to comment.