Skip to content
Snippets Groups Projects
Commit b6264ea7 authored by Erick Hitter's avatar Erick Hitter
Browse files

Rename

parent 1c44d595
No related branches found
No related tags found
1 merge request!5Prepare plugin for WP.org
Pipeline #5029 failed with stages
in 2 minutes and 49 seconds
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
**Donate link:** https://ethitter.com/donate/ **Donate link:** https://ethitter.com/donate/
**Tags:** user sessions, session tokens, session storage **Tags:** user sessions, session tokens, session storage
**Requires at least:** 4.0 **Requires at least:** 4.0
**Tested up to:** 5.2 **Tested up to:** 6.0
**Stable tag:** 0.1 **Stable tag:** 0.2
**Requires PHP:** 5.3 **Requires PHP:** 5.6
**License:** GPLv2 or later **License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html **License URI:** http://www.gnu.org/licenses/gpl-2.0.html
...@@ -31,5 +31,8 @@ Specify `WP_REDIS_USER_SESSION_HOST`, `WP_REDIS_USER_SESSION_PORT`, and `WP_REDI ...@@ -31,5 +31,8 @@ Specify `WP_REDIS_USER_SESSION_HOST`, `WP_REDIS_USER_SESSION_PORT`, and `WP_REDI
## Changelog ## ## Changelog ##
### 0.2 ###
* Rename plugin to `Redis Session Storage` and submit to WordPress.org plugins repository.
### 0.1 ### ### 0.1 ###
* Initial public release * Initial public release
...@@ -7,12 +7,9 @@ ...@@ -7,12 +7,9 @@
namespace Redis_User_Session_Storage; namespace Redis_User_Session_Storage;
/** use Redis;
* Don't load in contexts that lack the WP_Session_Tokens class use RedisException;
*/ use WP_Session_Tokens;
if ( ! class_exists( 'WP_Session_Tokens' ) ) {
return;
}
/** /**
* Redis-based user sessions token manager. * Redis-based user sessions token manager.
...@@ -272,13 +269,3 @@ class Plugin extends WP_Session_Tokens { ...@@ -272,13 +269,3 @@ class Plugin extends WP_Session_Tokens {
return $this->prefix . ':' . $this->user_id; return $this->prefix . ':' . $this->user_id;
} }
} }
/**
* Override Core's default usermeta-based token storage
*
* @return string
*/
function redis_user_session_storage() {
return Plugin::class;
}
add_filter( 'session_token_manager', 'redis_user_session_storage' );
# Copyright (C) 2022 Erick Hitter # Copyright (C) 2022 Erick Hitter
# This file is distributed under the same license as the WP Redis User Session Storage package. # This file is distributed under the same license as the Redis User Session Storage package.
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WP Redis User Session Storage 0.1\n" "Project-Id-Version: Redis User Session Storage 0.2\n"
"Report-Msgid-Bugs-To: " "Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/wp-redis-user-session-storage\n" "https://wordpress.org/support/plugin/redis-user-session-storage\n"
"POT-Creation-Date: 2022-07-01 04:12:36+00:00\n" "POT-Creation-Date: 2022-07-09 00:58:27+00:00\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n" "Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
...@@ -26,11 +26,11 @@ msgstr "" ...@@ -26,11 +26,11 @@ msgstr ""
"X-Generator: grunt-wp-i18n 1.0.3\n" "X-Generator: grunt-wp-i18n 1.0.3\n"
#. Plugin Name of the plugin/theme #. Plugin Name of the plugin/theme
msgid "WP Redis User Session Storage" msgid "Redis User Session Storage"
msgstr "" msgstr ""
#. Plugin URI of the plugin/theme #. Plugin URI of the plugin/theme
msgid "https://ethitter.com/plugins/wp-redis-user-session-storage/" msgid "https://ethitter.com/plugins/redis-user-session-storage/"
msgstr "" msgstr ""
#. Description of the plugin/theme #. Description of the plugin/theme
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<!-- Rules: Check PHP version compatibility --> <!-- Rules: Check PHP version compatibility -->
<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions --> <!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<config name="testVersion" value="5.3-"/> <config name="testVersion" value="5.6-"/>
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP --> <!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
<rule ref="PHPCompatibilityWP"/> <rule ref="PHPCompatibilityWP"/>
......
...@@ -3,9 +3,9 @@ Contributors: ethitter ...@@ -3,9 +3,9 @@ Contributors: ethitter
Donate link: https://ethitter.com/donate/ Donate link: https://ethitter.com/donate/
Tags: user sessions, session tokens, session storage Tags: user sessions, session tokens, session storage
Requires at least: 4.0 Requires at least: 4.0
Tested up to: 5.2 Tested up to: 6.0
Stable tag: 0.1 Stable tag: 0.2
Requires PHP: 5.3 Requires PHP: 5.6
License: GPLv2 or later License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html License URI: http://www.gnu.org/licenses/gpl-2.0.html
...@@ -31,5 +31,8 @@ Specify `WP_REDIS_USER_SESSION_HOST`, `WP_REDIS_USER_SESSION_PORT`, and `WP_REDI ...@@ -31,5 +31,8 @@ Specify `WP_REDIS_USER_SESSION_HOST`, `WP_REDIS_USER_SESSION_PORT`, and `WP_REDI
== Changelog == == Changelog ==
= 0.2 =
* Rename plugin to `Redis Session Storage` and submit to WordPress.org plugins repository.
= 0.1 = = 0.1 =
* Initial public release * Initial public release
...@@ -24,4 +24,55 @@ ...@@ -24,4 +24,55 @@
* @package Redis_User_Session_Storage * @package Redis_User_Session_Storage
*/ */
require_once __DIR__ . '/inc/class-redis-user-session-storage.php'; namespace Redis_User_Session_Storage;
use Redis;
use WP_Redis_User_Session_Storage;
use WP_Session_Tokens;
/**
* Load plugin when safe to do so, accounting for previous plugin name.
*
* WordPress.org no longer accepts plugins beginning with the `WP` prefix, so
* this was renamed to comply.
*
* @return void
*/
function load() {
if ( ! class_exists( Redis::class, false ) ) {
return;
}
if ( ! class_exists( WP_Session_Tokens::class, false ) ) {
return;
}
if ( class_exists( WP_Redis_User_Session_Storage::class, false ) ) {
// TODO: warn user to disable old plugin.
return;
}
require_once __DIR__ . '/inc/class-plugin.php';
class_alias(
Plugin::class,
'WP_Redis_User_Session_Storage',
false
);
add_filter(
'session_token_manager',
__NAMESPACE__ . '\set_session_token_manager'
);
}
add_action( 'plugins_loaded', __NAMESPACE__ . '\load' );
/**
* Override Core's default usermeta-based token storage
*
* @return string
*/
function set_session_token_manager() {
return Plugin::class;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment