Only do 1 time isFile() check and use lastModified() method (#25007)

This commit is contained in:
M. Vugteveen 2018-07-30 15:38:17 +02:00 committed by Taylor Otwell
parent 683637a5c0
commit 0879b42001
1 changed files with 3 additions and 3 deletions

View File

@ -66,9 +66,9 @@ class FileSessionHandler implements SessionHandlerInterface
*/
public function read($sessionId)
{
if ($this->files->exists($path = $this->path.'/'.$sessionId)) {
if (filemtime($path) >= Carbon::now()->subMinutes($this->minutes)->getTimestamp()) {
return $this->files->get($path, true);
if ($this->files->isFile($path = $this->path.'/'.$sessionId)) {
if ($this->files->lastModified($path) >= Carbon::now()->subMinutes($this->minutes)->getTimestamp()) {
return $this->files->sharedGet($path);
}
}