Skip to content

Commit 801cb5f

Browse files
committed
docs: update Session Config file and properties
1 parent c047930 commit 801cb5f

6 files changed

Lines changed: 35 additions & 22 deletions

File tree

user_guide_src/source/libraries/sessions.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ By default, the ``FileHandler`` Driver will be used when a session is initialize
459459
because it is the safest choice and is expected to work everywhere
460460
(virtually every environment has a file system).
461461

462-
However, any other driver may be selected via the ``public $sessionDriver``
463-
line in your **app/Config/App.php** file, if you chose to do so.
462+
However, any other driver may be selected via the ``public $driver``
463+
line in your **app/Config/Session.php** file, if you chose to do so.
464464
Have it in mind though, every driver has different caveats, so be sure to
465465
get yourself familiar with them (below) before you make that choice.
466466

@@ -481,12 +481,12 @@ To be more specific, it doesn't support PHP's `directory level and mode
481481
formats used in session.save_path
482482
<https://www.php.net/manual/en/session.configuration.php#ini.session.save-path>`_,
483483
and it has most of the options hard-coded for safety. Instead, only
484-
absolute paths are supported for ``public $sessionSavePath``.
484+
absolute paths are supported for ``public string $savePath``.
485485

486486
Another important thing that you should know, is to make sure that you
487487
don't use a publicly-readable or shared directory for storing your session
488488
files. Make sure that *only you* have access to see the contents of your
489-
chosen *sessionSavePath* directory. Otherwise, anybody who can do that, can
489+
chosen *savePath* directory. Otherwise, anybody who can do that, can
490490
also steal any of the current sessions (also known as "session fixation"
491491
attack).
492492

@@ -534,7 +534,7 @@ However, there are some conditions that must be met:
534534

535535
In order to use the 'DatabaseHandler' session driver, you must also create this
536536
table that we already mentioned and then set it as your
537-
``$sessionSavePath`` value.
537+
``$savePath`` value.
538538
For example, if you would like to use 'ci_sessions' as your table name,
539539
you would do this:
540540

@@ -576,7 +576,7 @@ setting**. The examples below work both on MySQL and PostgreSQL::
576576
ALTER TABLE ci_sessions DROP PRIMARY KEY;
577577

578578
You can choose the Database group to use by adding a new line to the
579-
**app/Config/App.php** file with the name of the group to use:
579+
**app/Config/Session.php** file with the name of the group to use:
580580

581581
.. literalinclude:: sessions/040.php
582582

@@ -586,7 +586,7 @@ from the cli to generate a migration file for you::
586586
> php spark make:migration --session
587587
> php spark migrate
588588

589-
This command will take the **sessionSavePath** and **sessionMatchIP** settings into account
589+
This command will take the **savePath** and **matchIP** settings into account
590590
when it generates the code.
591591

592592
.. important:: Only MySQL and PostgreSQL databases are officially
@@ -617,7 +617,7 @@ both familiar with Redis and using it for other purposes.
617617

618618
Just as with the 'FileHandler' and 'DatabaseHandler' drivers, you must also configure
619619
the storage location for your sessions via the
620-
``$sessionSavePath`` setting.
620+
``$savePath`` setting.
621621
The format here is a bit different and complicated at the same time. It is
622622
best explained by the *phpredis* extension's README file, so we'll simply
623623
link you to it:
@@ -655,7 +655,7 @@ deleted after Y seconds have passed (but not necessarily that it won't
655655
expire earlier than that time). This happens very rarely, but should be
656656
considered as it may result in loss of sessions.
657657

658-
The ``$sessionSavePath`` format is fairly straightforward here,
658+
The ``$savePath`` format is fairly straightforward here,
659659
being just a ``host:port`` pair:
660660

661661
.. literalinclude:: sessions/042.php

user_guide_src/source/libraries/sessions/039.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
namespace Config;
44

55
use CodeIgniter\Config\BaseConfig;
6+
use CodeIgniter\Session\Handlers\FileHandler;
67

7-
class App extends BaseConfig
8+
class Session extends BaseConfig
89
{
9-
public $sessionDriver = 'CodeIgniter\Session\Handlers\DatabaseHandler';
10-
public $sessionSavePath = 'ci_sessions';
10+
// ...
11+
public string $driver = 'CodeIgniter\Session\Handlers\DatabaseHandler';
12+
// ...
13+
public string $savePath = 'ci_sessions';
1114
// ...
1215
}

user_guide_src/source/libraries/sessions/040.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
namespace Config;
44

55
use CodeIgniter\Config\BaseConfig;
6+
use CodeIgniter\Session\Handlers\FileHandler;
67

7-
class App extends BaseConfig
8+
class Session extends BaseConfig
89
{
9-
public $sessionDBGroup = 'groupName';
1010
// ...
11+
public ?string $DBGroup = 'groupName';
1112
}

user_guide_src/source/libraries/sessions/041.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
namespace Config;
44

55
use CodeIgniter\Config\BaseConfig;
6+
use CodeIgniter\Session\Handlers\FileHandler;
67

7-
class App extends BaseConfig
8+
class Session extends BaseConfig
89
{
9-
public $sessionDiver = 'CodeIgniter\Session\Handlers\RedisHandler';
10-
public $sessionSavePath = 'tcp://localhost:6379';
10+
// ...
11+
public string $driver = 'CodeIgniter\Session\Handlers\RedisHandler';
12+
// ...
13+
public string $savePath = 'tcp://localhost:6379';
1114
// ...
1215
}

user_guide_src/source/libraries/sessions/042.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
namespace Config;
44

55
use CodeIgniter\Config\BaseConfig;
6+
use CodeIgniter\Session\Handlers\FileHandler;
67

7-
class App extends BaseConfig
8+
class Session extends BaseConfig
89
{
9-
public $sessionDriver = 'CodeIgniter\Session\Handlers\MemcachedHandler';
10-
public $sessionSavePath = 'localhost:11211';
10+
// ...
11+
public string $driver = 'CodeIgniter\Session\Handlers\MemcachedHandler';
12+
// ...
13+
public string $savePath = 'localhost:11211';
1114
// ...
1215
}

user_guide_src/source/libraries/sessions/043.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
namespace Config;
44

55
use CodeIgniter\Config\BaseConfig;
6+
use CodeIgniter\Session\Handlers\FileHandler;
67

7-
class App extends BaseConfig
8+
class Session extends BaseConfig
89
{
10+
// ...
11+
912
// localhost will be given higher priority (5) here,
1013
// compared to 192.0.2.1 with a weight of 1.
11-
public $sessionSavePath = 'localhost:11211:5,192.0.2.1:11211:1';
14+
public string $savePath = 'localhost:11211:5,192.0.2.1:11211:1';
1215

1316
// ...
1417
}

0 commit comments

Comments
 (0)