Changeset 1058737
- Timestamp:
- 01/02/2015 11:40:54 PM (11 years ago)
- Location:
- wp-native-php-sessions/trunk
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
pantheon-sessions.php (modified) (4 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-native-php-sessions/trunk
-
Property
svn:ignore
set to
README.md
Thumbs.db
.git
.gitignore
-
Property
svn:ignore
set to
-
wp-native-php-sessions/trunk/pantheon-sessions.php
r996206 r1058737 2 2 /* 3 3 Plugin Name: Pantheon Sessions for WordPress 4 Version: 0. 1-alpha4 Version: 0.3-alpha 5 5 Description: Offload PHP sessions to your database for multi-server compatibility. 6 6 Author: Pantheon … … 37 37 $this->initialize_session_override(); 38 38 } 39 40 39 } 41 40 … … 185 184 } 186 185 186 187 /** 188 * Force the plugin to be the first loaded 189 * 190 */ 191 static public function force_first_load() 192 { 193 194 $path = str_replace( WP_PLUGIN_DIR . '/', '', __FILE__ ); 195 if ( $plugins = get_option( 'active_plugins' ) ) { 196 if ( $key = array_search( $path, $plugins ) ) { 197 array_splice( $plugins, $key, 1 ); 198 array_unshift( $plugins, $path ); 199 update_option( 'active_plugins', $plugins ); 200 } 201 } 202 203 return; 204 } 205 206 187 207 /** 188 208 * Get a randomized key … … 204 224 return Pantheon_Sessions::get_instance(); 205 225 } 226 227 add_action( 'activated_plugin', 'Pantheon_Sessions::force_first_load'); 228 206 229 Pantheon_Sessions(); -
wp-native-php-sessions/trunk/readme.txt
r1056537 r1058737 1 === Native PHP Sessions ===2 Contributors: getpantheon, danielbachhuber, Outlandish Josh, mpvanwinkle77, pantheondev1 === Pantheon-sessions === 2 Contributors: (this should be a list of wordpress.org userid's) 3 3 Donate link: https://www.getpantheon.com/ 4 Tags: pantheon, sessions4 Tags: comments, spam 5 5 Requires at least: 3.0.1 6 Tested up to: 4. 0.07 Stable tag: trunk6 Tested up to: 4.1 7 Stable tag: 0.3-alpha 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 13 13 == Description == 14 14 15 WordPress core does not use sessions, but sometimes they are required by your use case. PHP's native sessions give you everything you need, and have a lot less overhead than a custom session implementation.15 WordPress core does not use sessions, but sometimes they are required by your use case. 16 16 17 This plugin implements PHP's native session functionality backed by the WordPress database. This allows plugins, themes, and custom code to safely use PHP $_SESSIONs in a distributed environment where PHP's defaul ytempfile sessions won't work.17 This plugin implements PHP's native session functionality backed by the WordPress database. This allows plugins, themes, and custom code to safely use PHP $_SESSIONs in a distributed environment where PHP's default tempfile sessions won't work. 18 18 19 19 Note that primary development is on GitHub if you would like to contribute: … … 24 24 25 25 1. Upload to the `/wp-content/plugins/` directory 26 1. Activate the plugin through the 'Plugins' menu in WordPress26 2. Activate the plugin through the 'Plugins' menu in WordPress 27 27 28 28 That's it! … … 40 40 However, if you intend to scale your application, local tempfiles are a dangerous choice. They are not shared between different instances of the application, producing erratic behavior that can be impossible to debug. By storing them in the database the state of the sessions is shared across all application instances. 41 41 42 == Troubleshooting == 43 44 If you see an error like "Fatal error: session_start(): Failed to initialize storage module: user (path: ) in .../code/wp-content/plugins/plugin-that-uses-sessions/example.php on line 2" you likely have a plugin in the mu-plugins directory that is instantiating a session prior to this plugin loading. To fix, you will need to deactivate this plugin and instead load it via an mu-plugin that loads first, e.g. create an mu-plugin called 00.php and add a line in it to include the wp-native-php-sessions/pantheon-sessions.php file and the problem should disappear. 45 46 42 47 == Changelog == 43 48 44 49 = 0.1 = 45 50 * Initial release 51 52 = 0.3-alpha = 53 * Fixes issue related to WordPress plugin load order
Note: See TracChangeset
for help on using the changeset viewer.