overall code quality audit.

This commit is contained in:
Taylor Otwell
2012-01-25 15:31:04 -06:00
parent 45969e3593
commit af170af12d
11 changed files with 11 additions and 92 deletions

View File

@@ -73,10 +73,6 @@ class Bundler extends Task {
$repository = IoC::resolve('bundle.repository');
// This method is primarily responsible for gathering the data
// for all bundles that need to be installed. This allows us
// to verify the existence of the bundle before even getting
// started on the actual installation process.
foreach ($bundles as $bundle)
{
// First we'll call the bundle repository to gather the bundle data

View File

@@ -32,7 +32,7 @@ class Publisher {
*/
protected function move($source, $destination)
{
File::copy_dir($source, $destination);
File::cpdir($source, $destination);
}
/**

View File

@@ -78,7 +78,7 @@ class Database {
*/
protected function table()
{
return DB::connection()->table('laravel_migrations');
return DB::connection(Request::server('cli.db'))->table('laravel_migrations');
}
}

View File

@@ -1,69 +0,0 @@
<?php namespace Laravel\CLI\Tasks\Session;
use Laravel\File;
use Laravel\Config;
use Laravel\Database\Schema;
use Laravel\Session\Drivers\Sweeper;
class Manager 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 an 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!";
}
}