Refactor the file session driver.
This commit is contained in:
parent
115bde0b23
commit
f470796261
|
@ -10,10 +10,7 @@ class File implements Driver, Sweeper {
|
||||||
*/
|
*/
|
||||||
public function load($id)
|
public function load($id)
|
||||||
{
|
{
|
||||||
if (file_exists($path = SESSION_PATH.$id))
|
if (file_exists($path = SESSION_PATH.$id)) return unserialize(file_get_contents($path));
|
||||||
{
|
|
||||||
return unserialize(file_get_contents($path));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,10 +45,7 @@ public function sweep($expiration)
|
||||||
{
|
{
|
||||||
foreach (glob(SESSION_PATH.'*') as $file)
|
foreach (glob(SESSION_PATH.'*') as $file)
|
||||||
{
|
{
|
||||||
if (filetype($file) == 'file' and filemtime($file) < $expiration)
|
if (filetype($file) == 'file' and filemtime($file) < $expiration) @unlink($file);
|
||||||
{
|
|
||||||
@unlink($file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue