Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
27fdb1e3
Commit
27fdb1e3
authored
Jan 24, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added key and session tasks.
parent
20b4cf7b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
5 deletions
+86
-5
laravel/cli/dependencies.php
+11
-0
laravel/cli/tasks/session.php
+70
-0
laravel/core.php
+1
-0
laravel/database/schema.php
+0
-1
laravel/database/schema/grammars/mysql.php
+1
-1
laravel/database/schema/table.php
+2
-2
laravel/session.php
+1
-1
No files found.
laravel/cli/dependencies.php
View file @
27fdb1e3
...
...
@@ -36,6 +36,17 @@ IoC::singleton('task: key', function()
});
/**
* The session task is responsible for performing tasks related
* to the session store of the application. It can do things
* such as generating the session table or clearing expired
* sessions from storage.
*/
IoC
::
singleton
(
'task: session'
,
function
()
{
return
new
Tasks\Session
;
});
/**
* The bundle repository is responsible for communicating with
* the Laravel bundle sources to get information regarding any
* bundles that are requested for installation.
...
...
laravel/cli/tasks/session.php
0 → 100644
View file @
27fdb1e3
<?php
namespace
Laravel\CLI\Tasks
;
use
Laravel\File
;
use
Laravel\Config
;
use
Laravel\Database\Schema
;
use
Laravel\Session\Drivers\Sweeper
;
class
Session
extends
Task
{
/**
* Generate the session table on the database.
*
* @param array $arguments
* @return void
*/
public
function
table
(
$arguments
=
array
())
{
Schema
::
table
(
Config
::
get
(
'session.table'
),
function
(
$table
)
{
$table
->
create
();
// The session table consists simply of a ID, a UNIX timestamp to
// indicate the expiration time, and a blob field which will hold
// the serialized form of the session payload.
$table
->
string
(
'id'
)
->
length
(
40
)
->
primary
(
'session_primary'
);
$table
->
integer
(
'last_activity'
);
$table
->
text
(
'data'
);
});
// By default no session driver is specified in the configuration.
// Since the developer is requesting that the session table be
// created on the database, we'll set the driver to database
// to save an extra step for the developer.
$config
=
File
::
get
(
APP_PATH
.
'config/session'
.
EXT
);
$config
=
str_replace
(
"'driver' => '',"
,
"'driver' => 'database',"
,
$config
);
File
::
put
(
APP_PATH
.
'config/session'
.
EXT
,
$config
);
echo
"The table has been created! Database set as session driver."
;
}
/**
* Sweep the expired sessions from storage.
*
* @param array $arguments
* @return void
*/
public
function
sweep
(
$arguments
=
array
())
{
$driver
=
\Laravel\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, as stores like Memcached and APC will
// perform their own garbage collection.
if
(
$driver
instanceof
Sweeper
)
{
$lifetime
=
Config
::
get
(
'session.lifetime'
);
$driver
->
sweep
(
time
()
-
(
$lifetime
*
60
));
}
echo
"The session table has been swept!"
;
}
}
\ No newline at end of file
laravel/core.php
View file @
27fdb1e3
...
...
@@ -92,6 +92,7 @@ Autoloader::$mappings = array(
'Laravel\\CLI\\Tasks\\Migrate\\Resolver'
=>
SYS_PATH
.
'cli/tasks/migrate/resolver'
.
EXT
,
'Laravel\\CLI\\Tasks\\Migrate\\Database'
=>
SYS_PATH
.
'cli/tasks/migrate/database'
.
EXT
,
'Laravel\\CLI\\Tasks\\Key'
=>
SYS_PATH
.
'cli/tasks/key'
.
EXT
,
'Laravel\\CLI\\Tasks\\Session'
=>
SYS_PATH
.
'cli/tasks/session'
.
EXT
,
'Laravel\\Database\\Connection'
=>
SYS_PATH
.
'database/connection'
.
EXT
,
'Laravel\\Database\\Expression'
=>
SYS_PATH
.
'database/expression'
.
EXT
,
...
...
laravel/database/schema.php
View file @
27fdb1e3
...
...
@@ -29,7 +29,6 @@ class Schema {
*/
public
static
function
execute
(
$table
)
{
die
(
'here'
);
foreach
(
$table
->
commands
as
$command
)
{
$connection
=
DB
::
connection
(
$table
->
connection
);
...
...
laravel/database/schema/grammars/mysql.php
View file @
27fdb1e3
...
...
@@ -144,7 +144,7 @@ class MySQL extends Grammar {
*/
public
function
primary
(
Table
$table
,
Fluent
$command
)
{
return
$this
->
key
(
$table
,
$command
,
'PRIMARY KEY'
);
return
$this
->
key
(
$table
,
$command
->
name
(
null
)
,
'PRIMARY KEY'
);
}
/**
...
...
laravel/database/schema/table.php
View file @
27fdb1e3
...
...
@@ -67,7 +67,7 @@ class Table {
* @param string $name
* @return Fluent
*/
public
function
primary
(
$columns
,
$name
)
public
function
primary
(
$columns
,
$name
=
null
)
{
return
$this
->
key
(
__FUNCTION__
,
$columns
,
$name
);
}
...
...
@@ -148,7 +148,7 @@ class Table {
* @param string $name
* @return void
*/
public
function
drop_primary
(
$name
)
public
function
drop_primary
(
$name
=
null
)
{
return
$this
->
drop_key
(
__FUNCTION__
,
$name
);
}
...
...
laravel/session.php
View file @
27fdb1e3
...
...
@@ -38,7 +38,7 @@ class Session {
* @param string $driver
* @return Driver
*/
p
rotected
static
function
factory
(
$driver
)
p
ublic
static
function
factory
(
$driver
)
{
switch
(
$driver
)
{
...
...
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