From 4ca065093b43ec69ab559ee2243dc556272b9aef Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Sat, 9 Jul 2022 17:51:43 -0700
Subject: [PATCH] PHPCS

---
 inc/class-activation-deactivation-hooks.php | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/inc/class-activation-deactivation-hooks.php b/inc/class-activation-deactivation-hooks.php
index 21ce717..33b60b1 100644
--- a/inc/class-activation-deactivation-hooks.php
+++ b/inc/class-activation-deactivation-hooks.php
@@ -65,15 +65,22 @@ final class Activation_Deactivation_Hooks {
 		$key = 'session_tokens';
 
 		$count = $wpdb->get_var(
-			"SELECT COUNT(*) FROM $wpdb->usermeta WHERE meta_key = '$key'"
+			$wpdb->prepare(
+				"SELECT COUNT(*) FROM $wpdb->usermeta WHERE meta_key = %s",
+				$key
+			)
 		);
 
 		if ( ! $count ) {
 			wp_clear_scheduled_hook( $this->cron_hook );
+			return;
 		}
 
 		$wpdb->query(
-			"DELETE FROM $wpdb->usermeta WHERE meta_key = '$key' LIMIT 500"
+			$wpdb->prepare(
+				"DELETE FROM $wpdb->usermeta WHERE meta_key = %s LIMIT 500",
+				$key
+			)
 		);
 	}
 
-- 
GitLab