Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76d80da

Browse files
committed
Swap to our own database session driver.
1 parent c2d3eda commit 76d80da

2 files changed

Lines changed: 4 additions & 18 deletions

File tree

src/Illuminate/Session/DatabaseSessionHandler.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php namespace Illuminate\Session;
22

3+
use Illuminate\Database\Connection;
4+
35
class DatabaseSessionHandler implements \SessionHandlerInterface, ExistenceAwareInterface {
46

57
/**
@@ -63,11 +65,7 @@ public function read($sessionId)
6365
{
6466
$this->exists = true;
6567

66-
$session = unserialize($session);
67-
68-
$session['data'] = base64_decode($data);
69-
70-
return serialize($session);
68+
return base64_decode($session->payload);
7169
}
7270
}
7371

src/Illuminate/Session/SessionManager.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected function createDatabaseDriver()
7272

7373
$table = $connection->getTablePrefix().$this->app['config']['session.table'];
7474

75-
return $this->buildSession(new PdoSessionHandler($connection->getPdo(), $this->getDatabaseOptions($table)));
75+
return $this->buildSession($connection, $table);
7676
}
7777

7878
/**
@@ -87,18 +87,6 @@ protected function getDatabaseConnection()
8787
return $this->app['db']->connection($connection);
8888
}
8989

90-
91-
/**
92-
* Get the database session options.
93-
*
94-
* @param string $table
95-
* @return array
96-
*/
97-
protected function getDatabaseOptions($table)
98-
{
99-
return array('db_table' => $table, 'db_id_col' => 'id', 'db_data_col' => 'payload', 'db_time_col' => 'last_activity');
100-
}
101-
10290
/**
10391
* Create an instance of the APC session driver.
10492
*

0 commit comments

Comments
 (0)