From 4cb36d0fb16bdef6df526ad5d2181ed324e7fdeb Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Thu, 23 Nov 2017 16:09:45 +0200 Subject: [PATCH 1/4] remove the between operator in basic where clause (#22182) --- src/Illuminate/Database/Query/Builder.php | 2 +- src/Illuminate/Database/Query/Grammars/PostgresGrammar.php | 2 +- src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php | 2 +- src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Database/Query/Builder.php b/src/Illuminate/Database/Query/Builder.php index 466f59491ecc..4feb5862c095 100755 --- a/src/Illuminate/Database/Query/Builder.php +++ b/src/Illuminate/Database/Query/Builder.php @@ -178,7 +178,7 @@ class Builder */ public $operators = [ '=', '<', '>', '<=', '>=', '<>', '!=', '<=>', - 'like', 'like binary', 'not like', 'between', 'ilike', + 'like', 'like binary', 'not like', 'ilike', '&', '|', '^', '<<', '>>', 'rlike', 'regexp', 'not regexp', '~', '~*', '!~', '!~*', 'similar to', diff --git a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php b/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php index 641c6ac06895..61ec305299e5 100755 --- a/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/PostgresGrammar.php @@ -15,7 +15,7 @@ class PostgresGrammar extends Grammar */ protected $operators = [ '=', '<', '>', '<=', '>=', '<>', '!=', - 'like', 'not like', 'between', 'ilike', + 'like', 'not like', 'ilike', '&', '|', '#', '<<', '>>', '>>=', '=<<', '@>', '<@', '?', '?|', '?&', '||', '-', '-', '#-', ]; diff --git a/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php b/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php index 03dfd510af85..77aa46e99882 100755 --- a/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php @@ -32,7 +32,7 @@ class SQLiteGrammar extends Grammar */ protected $operators = [ '=', '<', '>', '<=', '>=', '<>', '!=', - 'like', 'not like', 'between', 'ilike', + 'like', 'not like', 'ilike', '&', '|', '<<', '>>', ]; diff --git a/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php b/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php index ec98f935587f..dfefda3a22a3 100755 --- a/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php +++ b/src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php @@ -14,7 +14,7 @@ class SqlServerGrammar extends Grammar */ protected $operators = [ '=', '<', '>', '<=', '>=', '!<', '!>', '<>', '!=', - 'like', 'not like', 'between', 'ilike', + 'like', 'not like', 'ilike', '&', '&=', '|', '|=', '^', '^=', ]; From c6aabf97be038bbff664dc4917a4469e088c3f14 Mon Sep 17 00:00:00 2001 From: Michael Strong Date: Fri, 24 Nov 2017 03:10:23 +1300 Subject: [PATCH 2/4] Update docs for queue:retry command (#22179) * Update docs for queue:retry command At the moment its not obvious that you can pass 'all' as an id without looking through the code. * Update RetryCommand.php --- src/Illuminate/Queue/Console/RetryCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Queue/Console/RetryCommand.php b/src/Illuminate/Queue/Console/RetryCommand.php index 095d9342da21..5ea49d53d385 100644 --- a/src/Illuminate/Queue/Console/RetryCommand.php +++ b/src/Illuminate/Queue/Console/RetryCommand.php @@ -12,7 +12,7 @@ class RetryCommand extends Command * * @var string */ - protected $signature = 'queue:retry {id* : The ID of the failed job.}'; + protected $signature = 'queue:retry {id* : The ID of the failed job or "all" to retry all jobs.}'; /** * The console command description. From 3cfb9b9132656cc7c2bf66f1cc573ce866ffe4a2 Mon Sep 17 00:00:00 2001 From: Beau Hastings Date: Thu, 23 Nov 2017 08:13:08 -0600 Subject: [PATCH 3/4] Fix connection resolver and static side effect (#22178) * Fix connection resolver and static side effect Fixes #22133 Signed-off-by: Beau Hastings * Formatting --- .../Database/DatabaseEloquentGlobalScopesTest.php | 14 ++++++++++++++ tests/Database/DatabaseEloquentIntegrationTest.php | 1 + tests/Database/DatabaseEloquentModelTest.php | 11 +++++++++++ 3 files changed, 26 insertions(+) diff --git a/tests/Database/DatabaseEloquentGlobalScopesTest.php b/tests/Database/DatabaseEloquentGlobalScopesTest.php index fe8a969729b2..719ef8e944c3 100644 --- a/tests/Database/DatabaseEloquentGlobalScopesTest.php +++ b/tests/Database/DatabaseEloquentGlobalScopesTest.php @@ -4,12 +4,26 @@ use Mockery as m; use PHPUnit\Framework\TestCase; +use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Database\Eloquent\Model as Eloquent; class DatabaseEloquentGlobalScopesTest extends TestCase { + public function setUp() + { + parent::setUp(); + + tap(new DB)->addConnection([ + 'driver' => 'sqlite', + 'database' => ':memory:', + ])->bootEloquent(); + } + public function tearDown() { m::close(); + + Eloquent::unsetConnectionResolver(); } public function testGlobalScopeIsApplied() diff --git a/tests/Database/DatabaseEloquentIntegrationTest.php b/tests/Database/DatabaseEloquentIntegrationTest.php index 02d8b51e9163..132e532e7e83 100644 --- a/tests/Database/DatabaseEloquentIntegrationTest.php +++ b/tests/Database/DatabaseEloquentIntegrationTest.php @@ -125,6 +125,7 @@ public function tearDown() } Relation::morphMap([], false); + Eloquent::unsetConnectionResolver(); } /** diff --git a/tests/Database/DatabaseEloquentModelTest.php b/tests/Database/DatabaseEloquentModelTest.php index a427a8d4d0d2..adf821c2c855 100755 --- a/tests/Database/DatabaseEloquentModelTest.php +++ b/tests/Database/DatabaseEloquentModelTest.php @@ -202,6 +202,7 @@ public function testWithMethodCallsQueryBuilderCorrectly() public function testWithoutMethodRemovesEagerLoadedRelationshipCorrectly() { $model = new EloquentModelWithoutRelationStub; + $this->addMockConnection($model); $instance = $model->newInstance()->newQuery()->without('foo'); $this->assertEmpty($instance->getEagerLoads()); } @@ -1832,6 +1833,16 @@ public function setIncrementing($value) { $this->incrementing = $value; } + + public function getConnection() + { + $mock = m::mock('Illuminate\Database\Connection'); + $mock->shouldReceive('getQueryGrammar')->andReturn(m::mock('Illuminate\Database\Query\Grammars\Grammar')); + $mock->shouldReceive('getPostProcessor')->andReturn(m::mock('Illuminate\Database\Query\Processors\Processor')); + $mock->shouldReceive('getName')->andReturn('name'); + + return $mock; + } } class EloquentKeyTypeModelStub extends EloquentModelStub From 40472b1ac507f5afd5a35dd88d42ec7707220325 Mon Sep 17 00:00:00 2001 From: Khan M Rashedun-Naby Date: Fri, 24 Nov 2017 18:24:47 +0600 Subject: [PATCH 4/4] tooManyAttempts method of RateLimiter class parameter fix --- src/Illuminate/Cache/RateLimiter.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Illuminate/Cache/RateLimiter.php b/src/Illuminate/Cache/RateLimiter.php index 5bd79fdaf3e8..1de6ac8169ec 100644 --- a/src/Illuminate/Cache/RateLimiter.php +++ b/src/Illuminate/Cache/RateLimiter.php @@ -32,10 +32,9 @@ public function __construct(Cache $cache) * * @param string $key * @param int $maxAttempts - * @param float|int $decayMinutes * @return bool */ - public function tooManyAttempts($key, $maxAttempts, $decayMinutes = 1) + public function tooManyAttempts($key, $maxAttempts) { if ($this->attempts($key) >= $maxAttempts) { if ($this->cache->has($key.':timer')) {