Plugin Directory

Changeset 1058737


Ignore:
Timestamp:
01/02/2015 11:40:54 PM (11 years ago)
Author:
mpvanwinkle77
Message:

Preparing for 0.3-alpha release

Location:
wp-native-php-sessions/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-native-php-sessions/trunk

    • Property svn:ignore set to
      README.md
      Thumbs.db
      .git
      .gitignore
  • wp-native-php-sessions/trunk/pantheon-sessions.php

    r996206 r1058737  
    22/*
    33Plugin Name: Pantheon Sessions for WordPress
    4 Version: 0.1-alpha
     4Version: 0.3-alpha
    55Description: Offload PHP sessions to your database for multi-server compatibility.
    66Author: Pantheon
     
    3737            $this->initialize_session_override();
    3838        }
    39 
    4039    }
    4140
     
    185184    }
    186185
     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
    187207    /**
    188208     * Get a randomized key
     
    204224    return Pantheon_Sessions::get_instance();
    205225}
     226
     227add_action( 'activated_plugin', 'Pantheon_Sessions::force_first_load');
     228
    206229Pantheon_Sessions();
  • wp-native-php-sessions/trunk/readme.txt

    r1056537 r1058737  
    1 === Native PHP Sessions ===
    2 Contributors: getpantheon, danielbachhuber, Outlandish Josh, mpvanwinkle77, pantheondev
     1=== Pantheon-sessions ===
     2Contributors: (this should be a list of wordpress.org userid's)
    33Donate link: https://www.getpantheon.com/
    4 Tags: pantheon, sessions
     4Tags: comments, spam
    55Requires at least: 3.0.1
    6 Tested up to: 4.0.0
    7 Stable tag: trunk
     6Tested up to: 4.1
     7Stable tag: 0.3-alpha
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    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.
     15WordPress core does not use sessions, but sometimes they are required by your use case.
    1616
    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 defauly tempfile sessions won't work.
     17This 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.
    1818
    1919Note that primary development is on GitHub if you would like to contribute:
     
    2424
    25251. Upload to the `/wp-content/plugins/` directory
    26 1. Activate the plugin through the 'Plugins' menu in WordPress
     262. Activate the plugin through the 'Plugins' menu in WordPress
    2727
    2828That's it!
     
    4040However, 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.
    4141
     42== Troubleshooting ==
     43
     44If 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
    4247== Changelog ==
    4348
    4449= 0.1 =
    4550* 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.