From 656f984a3f53bd8d72eaec478327558c6dd28ee5 Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Fri, 8 Jul 2022 20:38:03 -0700 Subject: [PATCH] Better documentation --- README.md | 29 ++++++++++++++++++------ languages/redis-user-session-storage.pot | 2 +- phpcs.xml | 4 ++-- readme.txt | 29 ++++++++++++++++++------ redis-user-session-storage.php | 6 ++--- 5 files changed, 50 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 7a2ca59..04b608f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# WP Redis User Session Storage # +# Redis User Session Storage # **Contributors:** [ethitter](https://profiles.wordpress.org/ethitter/) **Donate link:** https://ethitter.com/donate/ **Tags:** user sessions, session tokens, session storage **Requires at least:** 4.0 **Tested up to:** 6.0 **Stable tag:** 0.2 -**Requires PHP:** 5.6 +**Requires PHP:** 5.3 **License:** GPLv2 or later **License URI:** http://www.gnu.org/licenses/gpl-2.0.html @@ -15,24 +15,39 @@ Store WordPress session tokens in Redis rather than the usermeta table. Store WordPress user session tokens in Redis rather than the usermeta table. +This plugin was previously known as `WP Redis User Session Storage` and was renamed to comply with WordPress.org naming constraints. + ## Installation ## -1. Install and configure Redis. There is a good tutorial [here](http://www.saltwebsites.com/2012/install-redis-245-service-centos-6). +1. Install and configure Redis. 2. Install the [Redis PECL module](http://pecl.php.net/package/redis). 3. Activate the plugin network-wide or by placing it in `mu-plugins`. -4. By default, the script will connect to Redis at 127.0.0.1:6379. See the *Connecting to Redis* section for further options. +4. By default, the script will connect to Redis at `127.0.0.1:6379`. See the *Connecting to Redis* section for further options. ## Frequently Asked Questions ## ### Connecting to Redis ### -By default, the plugin uses `127.0.0.1` and `6379` as the default host and port when creating a new client instance; the default database of `0` is also used. Three constants are provided to override these default values. +By default, the plugin uses `127.0.0.1` and `6379` as the default host and port, respectively, when creating a new client instance; the default database of `0` is also used. + +Specify any of the following constants to set the necessary, non-default connection values for your Redis instance: + +* `WP_REDIS_USER_SESSION_HOST` - Hostname or IP of the Redis server, defaults to `127.0.0.1`. +* `WP_REDIS_USER_SESSION_PORT` - Port of the Redis server, defaults to `6379`. +* `WP_REDIS_USER_SESSION_SOCKET` - Path to a Unix socket file for the Redis server, if available. Takes precedence over the port value when set. +* `WP_REDIS_USER_SESSION_AUTH` - Password for the Redis server, if required. +* `WP_REDIS_USER_SESSION_DB` - Database number to use for the Redis server, defaults to `0`. +* `WP_REDIS_USER_SESSION_SERIALIZER` - Serializer to use for the Redis server, defaults to `Redis::SERIALIZER_PHP`. + +### How do I upgrade from WP Redis User Session Storage? ### -Specify `WP_REDIS_USER_SESSION_HOST`, `WP_REDIS_USER_SESSION_PORT`, and `WP_REDIS_USER_SESSION_DB` to set the necessary, non-default connection values for your Redis instance. +Install and activate this plugin, then deactivate the old plugin. Both plugins can safely be activated together as long as no additional classes extend the `WP_Redis_User_Session_Storage` class. After activating this plugin, deactivate the `WP Redis User Session Storage` plugin and remove it. ## Changelog ## ### 0.2 ### -* Rename plugin to `Redis Session Storage` and submit to WordPress.org plugins repository. +* Rename plugin to `Redis User Session Storage` to submit to WordPress.org plugins repository. +* 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`. ### 0.1 ### * Initial public release diff --git a/languages/redis-user-session-storage.pot b/languages/redis-user-session-storage.pot index ae42c2b..2cc9a2d 100644 --- a/languages/redis-user-session-storage.pot +++ b/languages/redis-user-session-storage.pot @@ -5,7 +5,7 @@ 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-09 03:10:26+00:00\n" +"POT-Creation-Date: 2022-07-09 03:37:36+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/phpcs.xml b/phpcs.xml index 1b51033..40f1f92 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,5 +1,5 @@ <?xml version="1.0"?> -<ruleset name="WP Redis User Session Storage"> +<ruleset name="Redis User Session Storage"> <description>Generally-applicable sniffs for WordPress plugins.</description> <!-- What to scan --> @@ -18,7 +18,7 @@ <!-- Rules: Check PHP version compatibility --> <!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions --> - <config name="testVersion" value="5.6-"/> + <config name="testVersion" value="5.3-"/> <!-- https://github.com/PHPCompatibility/PHPCompatibilityWP --> <rule ref="PHPCompatibilityWP"/> diff --git a/readme.txt b/readme.txt index a72a3ea..1482d4c 100644 --- a/readme.txt +++ b/readme.txt @@ -1,11 +1,11 @@ -=== WP Redis User Session Storage === +=== Redis User Session Storage === Contributors: ethitter Donate link: https://ethitter.com/donate/ Tags: user sessions, session tokens, session storage Requires at least: 4.0 Tested up to: 6.0 Stable tag: 0.2 -Requires PHP: 5.6 +Requires PHP: 5.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -15,24 +15,39 @@ Store WordPress session tokens in Redis rather than the usermeta table. Store WordPress user session tokens in Redis rather than the usermeta table. +This plugin was previously known as `WP Redis User Session Storage` and was renamed to comply with WordPress.org naming constraints. + == Installation == -1. Install and configure Redis. There is a good tutorial [here](http://www.saltwebsites.com/2012/install-redis-245-service-centos-6). +1. Install and configure Redis. 2. Install the [Redis PECL module](http://pecl.php.net/package/redis). 3. Activate the plugin network-wide or by placing it in `mu-plugins`. -4. By default, the script will connect to Redis at 127.0.0.1:6379. See the *Connecting to Redis* section for further options. +4. By default, the script will connect to Redis at `127.0.0.1:6379`. See the *Connecting to Redis* section for further options. == Frequently Asked Questions == = Connecting to Redis = -By default, the plugin uses `127.0.0.1` and `6379` as the default host and port when creating a new client instance; the default database of `0` is also used. Three constants are provided to override these default values. +By default, the plugin uses `127.0.0.1` and `6379` as the default host and port, respectively, when creating a new client instance; the default database of `0` is also used. + +Specify any of the following constants to set the necessary, non-default connection values for your Redis instance: + +* `WP_REDIS_USER_SESSION_HOST` - Hostname or IP of the Redis server, defaults to `127.0.0.1`. +* `WP_REDIS_USER_SESSION_PORT` - Port of the Redis server, defaults to `6379`. +* `WP_REDIS_USER_SESSION_SOCKET` - Path to a Unix socket file for the Redis server, if available. Takes precedence over the port value when set. +* `WP_REDIS_USER_SESSION_AUTH` - Password for the Redis server, if required. +* `WP_REDIS_USER_SESSION_DB` - Database number to use for the Redis server, defaults to `0`. +* `WP_REDIS_USER_SESSION_SERIALIZER` - Serializer to use for the Redis server, defaults to `Redis::SERIALIZER_PHP`. + += How do I upgrade from WP Redis User Session Storage? = -Specify `WP_REDIS_USER_SESSION_HOST`, `WP_REDIS_USER_SESSION_PORT`, and `WP_REDIS_USER_SESSION_DB` to set the necessary, non-default connection values for your Redis instance. +Install and activate this plugin, then deactivate the old plugin. Both plugins can safely be activated together as long as no additional classes extend the `WP_Redis_User_Session_Storage` class. After activating this plugin, deactivate the `WP Redis User Session Storage` plugin and remove it. == Changelog == = 0.2 = -* Rename plugin to `Redis Session Storage` and submit to WordPress.org plugins repository. +* Rename plugin to `Redis User Session Storage` to submit to WordPress.org plugins repository. +* 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`. = 0.1 = * Initial public release diff --git a/redis-user-session-storage.php b/redis-user-session-storage.php index 6348cb4..7aaccbe 100644 --- a/redis-user-session-storage.php +++ b/redis-user-session-storage.php @@ -48,9 +48,11 @@ function load() { require_once __DIR__ . '/inc/class-plugin.php'; + // Hooked at 9 in case old plugin is also active. add_filter( 'session_token_manager', - __NAMESPACE__ . '\set_session_token_manager' + __NAMESPACE__ . '\set_session_token_manager', + 9 ); } load(); @@ -64,8 +66,6 @@ load(); function set_session_token_manager( $manager ) { if ( class_exists( WP_Redis_User_Session_Storage::class, false ) ) { add_action( 'admin_notices', __NAMESPACE__ . '\admin_notice' ); - - return $manager; } return Plugin::class; -- GitLab