Skip to content

Commit 4c8160f

Browse files
committed
Merge branch 'dev' of https://github.com/WebFiori/framework into dev
2 parents 9f61568 + 1e02c94 commit 4c8160f

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

bootstrap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@
9393
//run code after tests completion.
9494
register_shutdown_function(function()
9595
{
96+
$sessionDb = new webfiori\framework\session\DatabaseSessionStorage();
97+
$sessionDb->dropTables();
9698
ConfigController::get()->removeConfigFiles();
9799
});
98100
fprintf(STDOUT, "Registering shutdown function completed.\n");

webfiori/framework/session/DatabaseSessionStorage.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ public function __construct() {
4343
throw new DatabaseException($ex->getMessage(), $ex->getCode(), $ex);
4444
}
4545
}
46+
/**
47+
* Drop the tables which are used to store sessions information.
48+
*
49+
* The method will drop two tables, the table 'session_data' and the
50+
* table 'sessions'.
51+
*/
52+
public function dropTables() {
53+
$this->getController()->table('session_data')->drop()->execute();
54+
$this->getController()->table('sessions')->drop()->execute();
55+
}
4656
/**
4757
* Removes all inactive sessions from the database.
4858
*/

webfiori/framework/session/SessionsManager.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ public static function remove(string $varName) {
329329
/**
330330
* Reset sessions manager to defaults.
331331
*
332+
* This method will clear all sessions, set session storage to 'DefaultSessionStorage',
333+
* and set active session to null.
334+
*
332335
* @since 1.0
333336
*/
334337
public static function reset() {

0 commit comments

Comments
 (0)