Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
f27ec7ab
Commit
f27ec7ab
authored
Feb 14, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning up the session cli task.
parent
6ced385d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
16 deletions
+28
-16
manager.php
laravel/cli/tasks/session/manager.php
+28
-16
No files found.
laravel/cli/tasks/session/manager.php
View file @
f27ec7ab
...
...
@@ -5,9 +5,7 @@ use Laravel\File;
use
Laravel\Config
;
use
Laravel\Session
;
use
Laravel\CLI\Tasks\Task
;
use
Laravel\Database\Schema
;
use
Laravel\Session\Drivers\Sweeper
;
use
Laravel\CLI\Tasks\Migrate\Migrator
;
class
Manager
extends
Task
{
...
...
@@ -37,18 +35,10 @@ class Manager extends Task {
File
::
put
(
$migration
,
File
::
get
(
$stub
));
// By default no session driver is s
pecified
in the configuration.
// By default no session driver is s
et with
in the configuration.
// Since the developer is requesting that the session table be
// created on the database, we'll set the driver.
$config
=
File
::
get
(
path
(
'app'
)
.
'config/session'
.
EXT
);
$config
=
str_replace
(
"'driver' => '',"
,
"'driver' => 'database',"
,
$config
);
File
::
put
(
path
(
'app'
)
.
'config/session'
.
EXT
,
$config
);
// created on the database, we'll set it.
$this
->
driver
(
'database'
);
echo
PHP_EOL
;
...
...
@@ -65,9 +55,9 @@ class Manager extends Task {
{
$driver
=
Session
::
factory
(
Config
::
get
(
'session.driver'
));
// If the driver implements the "Sweeper" interface, we know that
//
it can sweep expired sessions from storage. Not all drivers
//
need be
sweepers since they do their own.
// If the driver implements the "Sweeper" interface, we know that
it
//
can sweep expired sessions from storage. Not all drivers need be
// sweepers since they do their own.
if
(
$driver
instanceof
Sweeper
)
{
$lifetime
=
Config
::
get
(
'session.lifetime'
);
...
...
@@ -78,4 +68,26 @@ class Manager extends Task {
echo
"The session table has been swept!"
;
}
/**
* Set the session driver to a given value.
*
* @param string $driver
* @return void
*/
protected
function
driver
(
$driver
)
{
// By default no session driver is set within the configuration.
// This method will replace the empty driver option with the
// driver specified in the arguments.
$config
=
File
::
get
(
path
(
'app'
)
.
'config/session'
.
EXT
);
$config
=
str_replace
(
"'driver' => '',"
,
"'driver' => 'database',"
,
$config
);
File
::
put
(
path
(
'app'
)
.
'config/session'
.
EXT
,
$config
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment