FilesHandler class

Framework\Session\SaveHandlers\FilesHandler

Class FilesHandler.

Extends Framework\Session\SaveHandler

Implements: SessionUpdateTimestampHandlerInterface, SessionHandlerInterface

Defined in libraries/session/src/SaveHandlers/FilesHandler.php

Properties #

$stream
-

$stream

protected $stream = NULL

Methods #

close()
-
destroy()
-
gc()
-
open()
-
read()
-
updateTimestamp()
-
write()
-
gcSubdir()
-
getFilename()
Get the filename, using the optional match IP and match User-Agent configs.
lock()
-
prepareConfig()
Prepare configurations to be used by the FilesHandler.
readData()
-
unlock()
-

close()

public function close(): bool
Returns bool

destroy()

public function destroy($id): bool
Parameters
  • $id
Returns bool

gc()

public function gc($max_lifetime): int|false
Parameters
  • $max_lifetime
Returns int|false

open()

public function open($path, $name): bool
Parameters
  • $path
  • $name
Returns bool

read()

public function read($id): string
Parameters
  • $id
Returns string

updateTimestamp()

public function updateTimestamp($id, $data): bool
Parameters
  • $id
  • $data
Returns bool

write()

public function write($id, $data): bool
Parameters
  • $id
  • $data
Returns bool

gcSubdir()

protected function gcSubdir(string $directory, int $maxMtime): int
Parameters
  • string $directory
  • int $maxMtime
Returns int

getFilename()

protected function getFilename(string $id): string

Get the filename, using the optional match IP and match User-Agent configs.

Parameters
  • string $id - The session id
Returns string - The final filename

lock()

protected function lock(string $id): bool
Parameters
  • string $id
Returns bool

prepareConfig()

protected function prepareConfig(array $config): void

Prepare configurations to be used by the FilesHandler.

Parameters
  • array $config - Custom configs The custom configs are: ```php $configs = [ // The directory path where the session files will be saved 'directory' => '', // A custom directory name inside the `directory` path 'prefix' => '', // Match IP? 'match_ip' => false, // Match User-Agent? 'match_ua' => false, ]; ```
Returns void

readData()

protected function readData(): string
Returns string

unlock()

protected function unlock(): bool
Returns bool

Inherited methods #