-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6989 from kenjis/refactor-add-session-config
refactor: add Config\Session
- Loading branch information
Showing
23 changed files
with
380 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
|
||
namespace Config; | ||
|
||
use CodeIgniter\Config\BaseConfig; | ||
use CodeIgniter\Session\Handlers\FileHandler; | ||
use SessionHandlerInterface; | ||
|
||
class Session extends BaseConfig | ||
{ | ||
/** | ||
* -------------------------------------------------------------------------- | ||
* Session Driver | ||
* -------------------------------------------------------------------------- | ||
* | ||
* The session storage driver to use: | ||
* - `CodeIgniter\Session\Handlers\FileHandler` | ||
* - `CodeIgniter\Session\Handlers\DatabaseHandler` | ||
* - `CodeIgniter\Session\Handlers\MemcachedHandler` | ||
* - `CodeIgniter\Session\Handlers\RedisHandler` | ||
* | ||
* @phpstan-var class-string<SessionHandlerInterface> | ||
*/ | ||
public string $driver = FileHandler::class; | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Session Cookie Name | ||
* -------------------------------------------------------------------------- | ||
* | ||
* The session cookie name, must contain only [0-9a-z_-] characters | ||
*/ | ||
public string $cookieName = 'ci_session'; | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Session Expiration | ||
* -------------------------------------------------------------------------- | ||
* | ||
* The number of SECONDS you want the session to last. | ||
* Setting to 0 (zero) means expire when the browser is closed. | ||
*/ | ||
public int $expiration = 7200; | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Session Save Path | ||
* -------------------------------------------------------------------------- | ||
* | ||
* The location to save sessions to and is driver dependent. | ||
* | ||
* For the 'files' driver, it's a path to a writable directory. | ||
* WARNING: Only absolute paths are supported! | ||
* | ||
* For the 'database' driver, it's a table name. | ||
* Please read up the manual for the format with other session drivers. | ||
* | ||
* IMPORTANT: You are REQUIRED to set a valid save path! | ||
*/ | ||
public string $savePath = WRITEPATH . 'session'; | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Session Match IP | ||
* -------------------------------------------------------------------------- | ||
* | ||
* Whether to match the user's IP address when reading the session data. | ||
* | ||
* WARNING: If you're using the database driver, don't forget to update | ||
* your session table's PRIMARY KEY when changing this setting. | ||
*/ | ||
public bool $matchIP = false; | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Session Time to Update | ||
* -------------------------------------------------------------------------- | ||
* | ||
* How many seconds between CI regenerating the session ID. | ||
*/ | ||
public int $timeToUpdate = 300; | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Session Regenerate Destroy | ||
* -------------------------------------------------------------------------- | ||
* | ||
* Whether to destroy session data associated with the old session ID | ||
* when auto-regenerating the session ID. When set to FALSE, the data | ||
* will be later deleted by the garbage collector. | ||
*/ | ||
public bool $regenerateDestroy = false; | ||
|
||
/** | ||
* -------------------------------------------------------------------------- | ||
* Session Database Group | ||
* -------------------------------------------------------------------------- | ||
* | ||
* DB Group for the database session. | ||
*/ | ||
public ?string $DBGroup = null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.