Skip to content

Commit

Permalink
Merge branch '5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Feb 23, 2015
2 parents 0f7dad6 + 0b16ba4 commit 09e384f
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 14 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -23,7 +23,7 @@
"monolog/monolog": "~1.11",
"mtdowling/cron-expression": "~1.0",
"nesbot/carbon": "~1.0",
"psy/psysh": "0.3.*",
"psy/psysh": "0.4.*",
"swiftmailer/swiftmailer": "~5.1",
"symfony/console": "2.7.*",
"symfony/debug": "2.7.*",
Expand Down
13 changes: 13 additions & 0 deletions src/Illuminate/Cache/MemcachedStore.php
Expand Up @@ -60,6 +60,19 @@ public function put($key, $value, $minutes)
$this->memcached->set($this->prefix.$key, $value, $minutes * 60);
}

/**
* Store an item in the cache if the key doesn't exist.
*
* @param string $key
* @param mixed $value
* @param int $minutes
* @return bool
*/
public function add($key, $value, $minutes)
{
return $this->memcached->add($this->prefix.$key, $value, $minutes * 60);
}

/**
* Increment the value of an item in the cache.
*
Expand Down
5 changes: 5 additions & 0 deletions src/Illuminate/Cache/Repository.php
Expand Up @@ -154,6 +154,11 @@ public function put($key, $value, $minutes)
*/
public function add($key, $value, $minutes)
{
if (method_exists($this->store, 'add'))
{
return $this->store->add($key, $value, $minutes);
}

if (is_null($this->get($key)))
{
$this->put($key, $value, $minutes); return true;
Expand Down
7 changes: 5 additions & 2 deletions src/Illuminate/Database/Connection.php
Expand Up @@ -651,12 +651,15 @@ protected function tryAgainIfCausedByLostConnection(QueryException $e, $query, $
/**
* Determine if the given exception was caused by a lost connection.
*
* @param \Illuminate\Database\QueryException
* @param \Illuminate\Database\QueryException $e
* @return bool
*/
protected function causedByLostConnection(QueryException $e)
{
return str_contains($e->getPrevious()->getMessage(), 'server has gone away');
$message = $e->getPrevious()->getMessage();

return str_contains($message, 'server has gone away')
|| str_contains($message, 'no connection to the server');
}

/**
Expand Down
Expand Up @@ -71,10 +71,20 @@ public function postLogin(Request $request)
return redirect($this->loginPath())
->withInput($request->only('email', 'remember'))
->withErrors([
'email' => 'These credentials do not match our records.',
'email' => $this->getFailedLoginMesssage(),
]);
}

/**
* Get the failed login message.
*
* @return string
*/
protected function getFailedLoginMesssage()
{
return 'These credentials do not match our records.';
}

/**
* Log the user out of the application.
*
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Foundation/Console/ServeCommand.php
Expand Up @@ -26,17 +26,17 @@ class ServeCommand extends Command {
*/
public function fire()
{
chdir($this->laravel->basePath());
chdir($this->laravel->publicPath());

$host = $this->input->getOption('host');

$port = $this->input->getOption('port');

$public = $this->laravel->publicPath();
$base = $this->laravel->basePath();

$this->info("Laravel development server started on http://{$host}:{$port}");

passthru('"'.PHP_BINARY.'"'." -S {$host}:{$port} -t \"{$public}\" server.php");
passthru('"'.PHP_BINARY.'"'." -S {$host}:{$port} \"{$base}\"/server.php");
}

/**
Expand Down
Expand Up @@ -8,7 +8,7 @@
class EloquentModelPresenter extends ObjectPresenter {

/**
* Determine if the presenter present the given value.
* Determine if the presenter can present the given value.
*
* @param mixed $value
* @return bool
Expand Down
Expand Up @@ -30,7 +30,7 @@ class IlluminateApplicationPresenter extends ObjectPresenter {
];

/**
* Determine if the presenter present the given value.
* Determine if the presenter can present the given value.
*
* @param mixed $value
* @return bool
Expand Down
Expand Up @@ -6,7 +6,7 @@
class IlluminateCollectionPresenter extends ArrayPresenter {

/**
* Determine if the presenter present the given value.
* Determine if the presenter can present the given value.
*
* @param mixed $value
* @return bool
Expand Down
20 changes: 19 additions & 1 deletion src/Illuminate/Foundation/Http/Kernel.php
Expand Up @@ -120,7 +120,9 @@ protected function sendRequestThroughRouter($request)
*/
public function terminate($request, $response)
{
foreach ($this->middleware as $middleware)
$routeMiddlewares = $this->gatherRouteMiddlewares($request);

foreach (array_merge($routeMiddlewares, $this->middleware) as $middleware)
{
$instance = $this->app->make($middleware);

Expand All @@ -133,6 +135,22 @@ public function terminate($request, $response)
$this->app->terminate();
}

/**
* Gather the route middleware for the given request.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
protected function gatherRouteMiddlewares($request)
{
if ($request->route())
{
return $this->router->gatherRouteMiddlewares($request->route());
}

return [];
}

/**
* Bootstrap the application for HTTP requests.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/Router.php
Expand Up @@ -699,7 +699,7 @@ protected function runRouteWithinStack(Route $route, Request $request)
* @param \Illuminate\Routing\Route $route
* @return array
*/
protected function gatherRouteMiddlewares(Route $route)
public function gatherRouteMiddlewares(Route $route)
{
return Collection::make($route->middleware())->map(function($m)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/View/Compilers/BladeCompiler.php
Expand Up @@ -687,10 +687,10 @@ protected function compileEndpush($expression)
/**
* Register a custom Blade compiler.
*
* @param \Closure $compiler
* @param callable $compiler
* @return void
*/
public function extend(Closure $compiler)
public function extend(callable $compiler)
{
$this->extensions[] = $compiler;
}
Expand Down

0 comments on commit 09e384f

Please sign in to comment.