From ec7e714c7621f6dff45859a7375bdf61cb796d7b Mon Sep 17 00:00:00 2001 From: Alorel Date: Thu, 29 Oct 2015 17:50:19 +0000 Subject: [PATCH] MySQL no event sessions --- .sensiolabs.yml | 3 + coverage/MySQLNoEventSession.php.html | 234 ++++++++++++ docs/404.html | 1 + docs/annotation-group-deprecated.html | 1 + docs/annotation-group-todo.html | 1 + ...-AloFramework.Session.AbstractSession.html | 7 + docs/class-AloFramework.Session.Config.html | 44 +++ ...Framework.Session.MySQLNoEventSession.html | 338 ++++++++++++++++++ ...ass-AloFramework.Session.MySQLSession.html | 7 + ...ass-AloFramework.Session.RedisSession.html | 1 + ...AloFramework.Session.SessionException.html | 1 + docs/class-ArrayAccess.html | 1 + docs/class-SessionHandlerInterface.html | 1 + docs/elementlist.js | 2 +- docs/index.html | 3 +- docs/namespace-AloFramework.Session.html | 8 +- docs/namespace-AloFramework.html | 2 +- docs/namespace-PHP.html | 2 +- docs/tree.html | 3 +- 19 files changed, 654 insertions(+), 6 deletions(-) create mode 100644 coverage/MySQLNoEventSession.php.html create mode 100644 docs/class-AloFramework.Session.MySQLNoEventSession.html diff --git a/.sensiolabs.yml b/.sensiolabs.yml index 3416609..cec6335 100644 --- a/.sensiolabs.yml +++ b/.sensiolabs.yml @@ -3,3 +3,6 @@ exclude_patterns: - tests/* - vendor/* - phpunit.* +rules: + php.dynamically_change_configuration: + enabled: false diff --git a/coverage/MySQLNoEventSession.php.html b/coverage/MySQLNoEventSession.php.html new file mode 100644 index 0000000..8ec8455 --- /dev/null +++ b/coverage/MySQLNoEventSession.php.html @@ -0,0 +1,234 @@ + + + + + Code Coverage for /home/art/Dropbox/sync/dev/www/aloframework/session/src/MySQLNoEventSession.php + + + + + + +
+
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
+
+ 100.00% covered (success) +
+
+
100.00%
1 / 1
+
+ 100.00% covered (success) +
+
+
100.00%
2 / 2
CRAP
+
+ 100.00% covered (success) +
+
+
100.00%
8 / 8
MySQLNoEventSession
+
+ 100.00% covered (success) +
+
+
100.00%
1 / 1
+
+ 100.00% covered (success) +
+
+
100.00%
2 / 2
2
+
+ 100.00% covered (success) +
+
+
100.00%
8 / 8
 gc
+
+ 100.00% covered (success) +
+
+
100.00%
1 / 1
1
+
+ 100.00% covered (success) +
+
+
100.00%
4 / 4
 start
+
+ 100.00% covered (success) +
+
+
100.00%
1 / 1
1
+
+ 100.00% covered (success) +
+
+
100.00%
4 / 4
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
<?php
    namespace AloFramework\Session;
    /**
     * A version of the MySQL session handler when event handling is impossible. The use of this class is not
     * recommended.
     * @author Art <a.molcanovas@gmail.com>
     */
    class MySQLNoEventSession extends MySQLSession {
        /**
         * Cleanup old sessions.
         * @author Art <a.molcanovas@gmail.com>
         * @link   http://php.net/manual/en/sessionhandlerinterface.gc.php
         *
         * @param int $maxLifeTime Sessions that have not updated for the last maxlifetime seconds will be removed.
         *
         * @return bool The return value (usually TRUE on success, FALSE on failure). Note this value is returned
         * internally to PHP for processing.
         */
        function gc($maxLifeTime) {
            $maxLifeTime = (int)$maxLifeTime;
            $table       = $this->config->table;
            return $this->client->prepare('DELETE FROM `' . $table . '` WHERE DATE_ADD(`access`, INTERVAL ' .
                                          $maxLifeTime . ' SECOND) < NOW()')->execute();
        }
        /**
         * Starts the session
         * @author Art <a.molcanovas@gmail.com>
         * @return self
         */
        function start() {
            ini_set('session.gc_probability', 1);
            ini_set('session.gc_divisor', (int)$this->config->gc);
            ini_set('session.gc_maxlifetime', (int)$this->config->timeout);
            return parent::start();
        }
    }
+ +
+ + + + + + diff --git a/docs/404.html b/docs/404.html index cd4d475..b2573d3 100644 --- a/docs/404.html +++ b/docs/404.html @@ -85,6 +85,7 @@

Classes