From d2aad78bd8d1d16b967c813fdee2020f82478fe6 Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Wed, 13 Jul 2022 16:12:16 -0700
Subject: [PATCH] Prepare for WP.org release

---
 Gruntfile.js                                |  2 +-
 README.md                                   |  5 ++-
 languages/wp-redis-user-session-storage.pot | 11 ++----
 phpcs.xml                                   |  2 +-
 readme.txt                                  |  5 ++-
 wp-redis-user-session-storage.php           | 37 ++++-----------------
 6 files changed, 15 insertions(+), 47 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index 284c0b3..bdb7ca0 100755
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -9,7 +9,7 @@ module.exports = function( grunt ) {
 
 		addtextdomain: {
 			options: {
-				textdomain: 'redis-user-session-storage',
+				textdomain: 'wp-redis-user-session-storage',
 			},
 			update_all_domains: {
 				options: {
diff --git a/README.md b/README.md
index f4f8f18..8ed5173 100644
--- a/README.md
+++ b/README.md
@@ -45,9 +45,8 @@ Install and activate this plugin, then deactivate the old plugin. Both plugins c
 ## Changelog ##
 
 ### 0.2 ###
-* Rename plugin to `Redis User Session Storage` to comply with WordPress.org plugin-naming requirements.
-* Allow two versions of this plugin to co-exist safely to support seamless migration.
-* Changes plugin class name to `Redis_User_Session_Storage` from `WP_Redis_User_Session_Storage`.
+* Add cleanup routine for usermeta storage.
+* Prepare plugin for WordPress.org release.
 
 ### 0.1 ###
 * Initial public release
diff --git a/languages/wp-redis-user-session-storage.pot b/languages/wp-redis-user-session-storage.pot
index 85c94f3..e6749d5 100644
--- a/languages/wp-redis-user-session-storage.pot
+++ b/languages/wp-redis-user-session-storage.pot
@@ -4,8 +4,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Redis User Session Storage 0.2\n"
 "Report-Msgid-Bugs-To: "
-"https://wordpress.org/support/plugin/redis-user-session-storage\n"
-"POT-Creation-Date: 2022-07-10 01:18:39+00:00\n"
+"https://wordpress.org/support/plugin/wp-redis-user-session-storage\n"
+"POT-Creation-Date: 2022-07-13 23:11:21+00:00\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -25,13 +25,6 @@ msgstr ""
 "X-Textdomain-Support: yes\n"
 "X-Generator: grunt-wp-i18n 1.0.3\n"
 
-#: wp-redis-user-session-storage.php:93
-#. translators: 1: New plugin name, 2: Old plugin name
-msgid ""
-"%1$s: An outdated version of this plugin, %2$s, is active. Please "
-"deactivate it to use the current version."
-msgstr ""
-
 #. Plugin Name of the plugin/theme
 msgid "Redis User Session Storage"
 msgstr ""
diff --git a/phpcs.xml b/phpcs.xml
index 04859b2..f10fb37 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -38,7 +38,7 @@
 	<rule ref="WordPress.WP.I18n">
 		<properties>
 			<!-- Value: replace the text domain used. -->
-			<property name="text_domain" type="array" value="redis-user-session-storage"/>
+			<property name="text_domain" type="array" value="wp-redis-user-session-storage"/>
 		</properties>
 	</rule>
 	<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
diff --git a/readme.txt b/readme.txt
index 59aafad..c71d172 100644
--- a/readme.txt
+++ b/readme.txt
@@ -45,9 +45,8 @@ Install and activate this plugin, then deactivate the old plugin. Both plugins c
 == Changelog ==
 
 = 0.2 =
-* Rename plugin to `Redis User Session Storage` to comply with WordPress.org plugin-naming requirements.
-* Allow two versions of this plugin to co-exist safely to support seamless migration.
-* Changes plugin class name to `Redis_User_Session_Storage` from `WP_Redis_User_Session_Storage`.
+* Add cleanup routine for usermeta storage.
+* Prepare plugin for WordPress.org release.
 
 = 0.1 =
 * Initial public release
diff --git a/wp-redis-user-session-storage.php b/wp-redis-user-session-storage.php
index aadce9a..d4efbe5 100644
--- a/wp-redis-user-session-storage.php
+++ b/wp-redis-user-session-storage.php
@@ -49,6 +49,13 @@ function load() {
 	require_once __DIR__ . '/inc/class-plugin.php';
 	require_once __DIR__ . '/inc/class-activation-deactivation-hooks.php';
 
+	// Alias plugin's original class name.
+	class_alias(
+		Plugin::class,
+		'WP_Redis_User_Session_Storage',
+		false
+	);
+
 	new Activation_Deactivation_Hooks( __FILE__ );
 
 	// Hooked at 9 in case old plugin is also active.
@@ -67,35 +74,5 @@ load();
  * @return string
  */
 function set_session_token_manager( $manager ) {
-	if ( class_exists( WP_Redis_User_Session_Storage::class, false ) ) {
-		add_action( 'admin_notices', __NAMESPACE__ . '\admin_notice' );
-	}
-
 	return Plugin::class;
 }
-
-/**
- * Show admin notice to certain users when older version is active.
- *
- * @return void
- */
-function admin_notice() {
-	if ( ! current_user_can( 'activate_plugins' ) ) {
-		return;
-	}
-
-	?>
-	<div id="message" class="error">
-		<p>
-			<?php
-				printf(
-					/* translators: 1: New plugin name, 2: Old plugin name */
-					esc_html__( '%1$s: An outdated version of this plugin, %2$s, is active. Please deactivate it to use the current version.', 'redis-user-session-storage' ),
-					'<strong>Redis User Session Storage</strong>',
-					'<em>WP Redis User Session Storage</em>'
-				);
-			?>
-		</p>
-	</div>
-	<?php
-}
-- 
GitLab