update v1.0.7.9 R.C.

This is a Release Candidate. We are still testing.
This commit is contained in:
Sujit Prasad
2016-08-03 20:04:36 +05:30
parent 8b6b924d09
commit ffa56a43cb
3830 changed files with 181529 additions and 495353 deletions

View File

@@ -82,7 +82,7 @@ class PasswordBroker implements PasswordBrokerContract
$user = $this->getUser($credentials);
if (is_null($user)) {
return PasswordBrokerContract::INVALID_USER;
return static::INVALID_USER;
}
// Once we have the reset token, we are ready to send the message out to this
@@ -92,7 +92,7 @@ class PasswordBroker implements PasswordBrokerContract
$this->emailResetLink($user, $token, $callback);
return PasswordBrokerContract::RESET_LINK_SENT;
return static::RESET_LINK_SENT;
}
/**
@@ -146,7 +146,7 @@ class PasswordBroker implements PasswordBrokerContract
$this->tokens->delete($credentials['token']);
return PasswordBrokerContract::PASSWORD_RESET;
return static::PASSWORD_RESET;
}
/**
@@ -158,15 +158,15 @@ class PasswordBroker implements PasswordBrokerContract
protected function validateReset(array $credentials)
{
if (is_null($user = $this->getUser($credentials))) {
return PasswordBrokerContract::INVALID_USER;
return static::INVALID_USER;
}
if (! $this->validateNewPassword($credentials)) {
return PasswordBrokerContract::INVALID_PASSWORD;
return static::INVALID_PASSWORD;
}
if (! $this->tokens->exists($user, $credentials['token'])) {
return PasswordBrokerContract::INVALID_TOKEN;
return static::INVALID_TOKEN;
}
return $user;

View File

@@ -1073,7 +1073,11 @@ class Container implements ArrayAccess, ContainerContract
*/
protected function getAlias($abstract)
{
return isset($this->aliases[$abstract]) ? $this->aliases[$abstract] : $abstract;
if (! isset($this->aliases[$abstract])) {
return $abstract;
}
return $this->getAlias($this->aliases[$abstract]);
}
/**

View File

@@ -32,13 +32,14 @@ class MySqlConnector extends Connector implements ConnectorInterface
// Next we will set the "names" and "collation" on the clients connections so
// a correct character set will be used by this client. The collation also
// is set on the server but needs to be set here on this client objects.
$charset = $config['charset'];
if (isset($config['charset'])) {
$charset = $config['charset'];
$names = "set names '$charset'".
(! is_null($collation) ? " collate '$collation'" : '');
$connection->prepare($names)->execute();
$names = "set names '$charset'".
(! is_null($collation) ? " collate '$collation'" : '');
$connection->prepare($names)->execute();
}
// Next, we will check to see if a timezone has been specified in this config
// and if it has we will issue a statement to modify the timezone with the
// database. Setting this DB timezone is an optional configuration item.

View File

@@ -1031,6 +1031,23 @@ class Builder
return $this;
}
/**
* Prevent the specified relations from being eager loaded.
*
* @param mixed $relations
* @return $this
*/
public function without($relations)
{
if (is_string($relations)) {
$relations = func_get_args();
}
$this->eagerLoad = array_diff_key($this->eagerLoad, array_flip($relations));
return $this;
}
/**
* Add subselect queries to count the relations.
*

View File

@@ -56,6 +56,13 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
*/
protected $primaryKey = 'id';
/**
* The "type" of the auto-incrementing ID.
*
* @var string
*/
protected $keyType = 'int';
/**
* The number of models to return for pagination.
*
@@ -654,6 +661,10 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
return;
}
if (is_string($with)) {
$with = func_get_args();
}
$key = $this->getKeyName();
return static::with($with)->where($key, $this->getKey())->first();
@@ -2759,7 +2770,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
{
if ($this->getIncrementing()) {
return array_merge([
$this->getKeyName() => 'int',
$this->getKeyName() => $this->keyType,
], $this->casts);
}

View File

@@ -174,7 +174,7 @@ class BelongsTo extends Relation
// null or 0 in (depending on if incrementing keys are in use) so the query wont
// fail plus returns zero results, which should be what the developer expects.
if (count($keys) === 0) {
return [$this->related->incrementing ? 0 : null];
return [$this->related->getIncrementing() ? 0 : null];
}
return array_values(array_unique($keys));

View File

@@ -187,7 +187,7 @@ class MorphTo extends BelongsTo
$query = $this->replayMacros($instance->newQuery())
->mergeModelDefinedRelationConstraints($this->getQuery())
->setEagerLoads($eagerLoads);
->with($eagerLoads);
return $query->whereIn($key, $this->gatherKeysByType($type)->all())->get();
}

View File

@@ -25,7 +25,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*
* @var string
*/
const VERSION = '5.2.37';
const VERSION = '5.2.39';
/**
* The base path for the Laravel installation.

View File

@@ -95,6 +95,7 @@ class AppNameCommand extends Command
{
$files = Finder::create()
->in($this->laravel['path'])
->contains($this->currentRoot)
->name('*.php');
foreach ($files as $file) {

View File

@@ -80,10 +80,20 @@ class FormRequest extends Request implements ValidatesWhenResolved
}
return $factory->make(
$this->all(), $this->container->call([$this, 'rules']), $this->messages(), $this->attributes()
$this->validationData(), $this->container->call([$this, 'rules']), $this->messages(), $this->attributes()
);
}
/**
* Get data to be validated from the request.
*
* @return array
*/
protected function validationData()
{
return $this->all();
}
/**
* Handle a failed validation attempt.
*
@@ -133,7 +143,7 @@ class FormRequest extends Request implements ValidatesWhenResolved
*/
public function response(array $errors)
{
if ($this->ajax() || $this->wantsJson()) {
if (($this->ajax() && ! $this->pjax()) || $this->wantsJson()) {
return new JsonResponse($errors, 422);
}

View File

@@ -171,7 +171,9 @@ class ProviderRepository
if ($this->files->exists($this->manifestPath)) {
$manifest = $this->files->getRequire($this->manifestPath);
return array_merge(['when' => []], $manifest);
if ($manifest) {
return array_merge(['when' => []], $manifest);
}
}
}

View File

@@ -118,10 +118,6 @@ abstract class TestCase extends PHPUnit_Framework_TestCase
*/
protected function tearDown()
{
if (class_exists('Mockery')) {
Mockery::close();
}
if ($this->app) {
foreach ($this->beforeApplicationDestroyedCallbacks as $callback) {
call_user_func($callback);
@@ -138,6 +134,10 @@ abstract class TestCase extends PHPUnit_Framework_TestCase
$this->serverVariables = [];
}
if (class_exists('Mockery')) {
Mockery::close();
}
$this->afterApplicationCreatedCallbacks = [];
$this->beforeApplicationDestroyedCallbacks = [];
}

View File

@@ -148,8 +148,6 @@ class Mailer implements MailerContract, MailQueueContract
*/
public function send($view, array $data, $callback)
{
$this->forceReconnection();
// First we need to parse the view, which could either be a string or an array
// containing both an HTML and plain text versions of the view which should
// be used when sending an e-mail. We will extract both of them out here.
@@ -383,7 +381,11 @@ class Mailer implements MailerContract, MailQueueContract
$this->events->fire(new Events\MessageSending($message));
}
return $this->swift->send($message, $this->failedRecipients);
try {
return $this->swift->send($message, $this->failedRecipients);
} finally {
$this->swift->getTransport()->stop();
}
}
/**

View File

@@ -97,6 +97,8 @@ class BeanstalkdJob extends Job implements JobContract
*/
public function bury()
{
parent::release();
$this->pheanstalk->bury($this->job);
}

View File

@@ -87,6 +87,8 @@ class DatabaseSessionHandler implements SessionHandlerInterface, ExistenceAwareI
if (isset($session->last_activity)) {
if ($session->last_activity < Carbon::now()->subMinutes($this->minutes)->getTimestamp()) {
$this->exists = true;
return;
}
}

View File

@@ -79,6 +79,8 @@ class LegacyDatabaseSessionHandler implements SessionHandlerInterface, Existence
if (isset($session->last_activity)) {
if ($session->last_activity < Carbon::now()->subMinutes($this->minutes)->getTimestamp()) {
$this->exists = true;
return;
}
}

View File

@@ -386,10 +386,10 @@ class Str
*/
public static function snake($value, $delimiter = '_')
{
$key = $value.$delimiter;
$key = $value;
if (isset(static::$snakeCache[$key])) {
return static::$snakeCache[$key];
if (isset(static::$snakeCache[$key][$delimiter])) {
return static::$snakeCache[$key][$delimiter];
}
if (! ctype_lower($value)) {
@@ -398,7 +398,7 @@ class Str
$value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value));
}
return static::$snakeCache[$key] = $value;
return static::$snakeCache[$key][$delimiter] = $value;
}
/**