overall code quality audit.
This commit is contained in:
parent
45969e3593
commit
af170af12d
|
@ -116,7 +116,7 @@ protected static function load_psr($class, $directory = null)
|
||||||
//
|
//
|
||||||
// We will check for both lowercase and CamelCase files as
|
// We will check for both lowercase and CamelCase files as
|
||||||
// Laravel uses a lowercase version of PSR-0, while true
|
// Laravel uses a lowercase version of PSR-0, while true
|
||||||
// PSR-0 uses CamelCase for file names.
|
// PSR-0 uses CamelCase for all file names.
|
||||||
foreach ($directories as $directory)
|
foreach ($directories as $directory)
|
||||||
{
|
{
|
||||||
if (file_exists($path = $directory.strtolower($file).EXT))
|
if (file_exists($path = $directory.strtolower($file).EXT))
|
||||||
|
|
|
@ -5,8 +5,6 @@ class Console {
|
||||||
/**
|
/**
|
||||||
* Parse the command line arguments and return the results.
|
* Parse the command line arguments and return the results.
|
||||||
*
|
*
|
||||||
* The returned array contains the arguments and the options.
|
|
||||||
*
|
|
||||||
* @param array $argv
|
* @param array $argv
|
||||||
* @param array
|
* @param array
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -73,10 +73,6 @@ protected function get($bundles)
|
||||||
|
|
||||||
$repository = IoC::resolve('bundle.repository');
|
$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)
|
foreach ($bundles as $bundle)
|
||||||
{
|
{
|
||||||
// First we'll call the bundle repository to gather the bundle data
|
// First we'll call the bundle repository to gather the bundle data
|
||||||
|
|
|
@ -32,7 +32,7 @@ public function publish($bundle)
|
||||||
*/
|
*/
|
||||||
protected function move($source, $destination)
|
protected function move($source, $destination)
|
||||||
{
|
{
|
||||||
File::copy_dir($source, $destination);
|
File::cpdir($source, $destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -78,7 +78,7 @@ public function batch()
|
||||||
*/
|
*/
|
||||||
protected function table()
|
protected function table()
|
||||||
{
|
{
|
||||||
return DB::connection()->table('laravel_migrations');
|
return DB::connection(Request::server('cli.db'))->table('laravel_migrations');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -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!";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -181,7 +181,7 @@ public static function is($extensions, $path)
|
||||||
* @param string $destination
|
* @param string $destination
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function copy_dir($source, $destination)
|
public static function cpdir($source, $destination)
|
||||||
{
|
{
|
||||||
if ( ! is_dir($source)) return;
|
if ( ! is_dir($source)) return;
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ public static function copy_dir($source, $destination)
|
||||||
{
|
{
|
||||||
$path = $item->getRealPath();
|
$path = $item->getRealPath();
|
||||||
|
|
||||||
static::copy_dir($path, $location);
|
static::cpdir($path, $location);
|
||||||
}
|
}
|
||||||
// If the file system item is an actual file, we can copy the
|
// If the file system item is an actual file, we can copy the
|
||||||
// file from the bundle asset directory to the public asset
|
// file from the bundle asset directory to the public asset
|
||||||
|
|
|
@ -21,7 +21,7 @@ function e($value)
|
||||||
* @param string $language
|
* @param string $language
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function __($key, $replacements = array(), $language = null)
|
function lang($key, $replacements = array(), $language = null)
|
||||||
{
|
{
|
||||||
return Laravel\Lang::line($key, $replacements, $language);
|
return Laravel\Lang::line($key, $replacements, $language);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,11 +124,6 @@ public static function resolve($name, $parameters = array())
|
||||||
return static::$singletons[$name];
|
return static::$singletons[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! static::registered($name))
|
|
||||||
{
|
|
||||||
throw new \Exception("Error resolving [$name]. No resolver has been registered.");
|
|
||||||
}
|
|
||||||
|
|
||||||
$object = call_user_func(static::$registry[$name]['resolver'], $parameters);
|
$object = call_user_func(static::$registry[$name]['resolver'], $parameters);
|
||||||
|
|
||||||
// If the resolver is registering as a singleton resolver, we will cache
|
// If the resolver is registering as a singleton resolver, we will cache
|
||||||
|
|
|
@ -43,7 +43,7 @@ public static function write($type, $message)
|
||||||
{
|
{
|
||||||
$message = date('Y-m-d H:i:s').' '.Str::upper($type)." - {$message}".PHP_EOL;
|
$message = date('Y-m-d H:i:s').' '.Str::upper($type)." - {$message}".PHP_EOL;
|
||||||
|
|
||||||
File::append(STORAGE_PATH.'logs/'.date('Y-m').'.log', $message);
|
File::append(STORAGE_PATH.'logs/'.date('Y-m-d').'.log', $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -375,17 +375,16 @@ protected function link($page, $text, $class)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the "appendage" that should be attached to every pagination link.
|
* Create the "appendage" to be attached to every pagination link.
|
||||||
*
|
|
||||||
* The developer may assign an array of values that will be converted to a
|
|
||||||
* query string and attached to every pagination link. This allows simple
|
|
||||||
* implementation of sorting or other things the developer may need.
|
|
||||||
*
|
*
|
||||||
* @param array $appends
|
* @param array $appends
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function appendage($appends)
|
protected function appendage($appends)
|
||||||
{
|
{
|
||||||
|
// The developer may assign an array of values that will be converted to a
|
||||||
|
// query string and attached to every pagination link. This allows simple
|
||||||
|
// implementation of sorting or other things the developer may need.
|
||||||
if ( ! is_null($this->appendage)) return $this->appendage;
|
if ( ! is_null($this->appendage)) return $this->appendage;
|
||||||
|
|
||||||
if (count($appends) <= 0)
|
if (count($appends) <= 0)
|
||||||
|
|
Loading…
Reference in New Issue