Skip to content

Commit 3233f4c

Browse files
committed
Merge tag 'v12.10.0'
Signed-off-by: Mior Muhammad Zaki <[email protected]>
2 parents 4b94581 + be0d6f3 commit 3233f4c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1462
-71
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Release Notes for 12.x
22

3-
## [Unreleased](https://github.com/laravel/framework/compare/v12.9.1...12.x)
3+
## [Unreleased](https://github.com/laravel/framework/compare/v12.9.2...12.x)
4+
5+
## [v12.9.2](https://github.com/laravel/framework/compare/v12.9.1...v12.9.2) - 2025-04-16
6+
7+
* [12.x] Fixed a bug in using `illuminate/console` in external apps by [@andrey-helldar](https://github.com/andrey-helldar) in https://github.com/laravel/framework/pull/55430
8+
* Disable SQLServer 2017 CI as `ubuntu-20.24` has been removed by [@crynobone](https://github.com/crynobone) in https://github.com/laravel/framework/pull/55425
49

510
## [v12.9.1](https://github.com/laravel/framework/compare/v12.9.0...v12.9.1) - 2025-04-16
611

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace Illuminate\Cache\Events;
4+
5+
class CacheFlushFailed
6+
{
7+
/**
8+
* The name of the cache store.
9+
*
10+
* @var string|null
11+
*/
12+
public $storeName;
13+
14+
/**
15+
* The tags that were assigned to the key.
16+
*
17+
* @var array
18+
*/
19+
public $tags;
20+
21+
/**
22+
* Create a new event instance.
23+
*
24+
* @param string|null $storeName
25+
* @return void
26+
*/
27+
public function __construct($storeName, array $tags = [])
28+
{
29+
$this->storeName = $storeName;
30+
$this->tags = $tags;
31+
}
32+
33+
/**
34+
* Set the tags for the cache event.
35+
*
36+
* @param array $tags
37+
* @return $this
38+
*/
39+
public function setTags($tags)
40+
{
41+
$this->tags = $tags;
42+
43+
return $this;
44+
}
45+
}

src/Illuminate/Cache/Events/CacheFlushed.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,35 @@ class CacheFlushed
1111
*/
1212
public $storeName;
1313

14+
/**
15+
* The tags that were assigned to the key.
16+
*
17+
* @var array
18+
*/
19+
public $tags;
20+
1421
/**
1522
* Create a new event instance.
1623
*
1724
* @param string|null $storeName
1825
* @return void
1926
*/
20-
public function __construct($storeName)
27+
public function __construct($storeName, array $tags = [])
2128
{
2229
$this->storeName = $storeName;
30+
$this->tags = $tags;
31+
}
32+
33+
/**
34+
* Set the tags for the cache event.
35+
*
36+
* @param array $tags
37+
* @return $this
38+
*/
39+
public function setTags($tags)
40+
{
41+
$this->tags = $tags;
42+
43+
return $this;
2344
}
2445
}

src/Illuminate/Cache/Events/CacheFlushing.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,35 @@ class CacheFlushing
1111
*/
1212
public $storeName;
1313

14+
/**
15+
* The tags that were assigned to the key.
16+
*
17+
* @var array
18+
*/
19+
public $tags;
20+
1421
/**
1522
* Create a new event instance.
1623
*
1724
* @param string|null $storeName
1825
* @return void
1926
*/
20-
public function __construct($storeName)
27+
public function __construct($storeName, array $tags = [])
2128
{
2229
$this->storeName = $storeName;
30+
$this->tags = $tags;
31+
}
32+
33+
/**
34+
* Set the tags for the cache event.
35+
*
36+
* @param array $tags
37+
* @return $this
38+
*/
39+
public function setTags($tags)
40+
{
41+
$this->tags = $tags;
42+
43+
return $this;
2344
}
2445
}

src/Illuminate/Cache/MemoizedStore.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,17 @@ public function many(array $keys)
7575
});
7676
}
7777

78-
$result = [
79-
...$memoized,
80-
...$retrieved,
81-
];
78+
$result = [];
8279

83-
return array_replace(array_flip($keys), $result);
80+
foreach ($keys as $key) {
81+
if (array_key_exists($key, $memoized)) {
82+
$result[$key] = $memoized[$key];
83+
} else {
84+
$result[$key] = $retrieved[$key];
85+
}
86+
}
87+
88+
return $result;
8489
}
8590

8691
/**

src/Illuminate/Cache/RateLimiter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function limiter($name)
9999
* @param string $key
100100
* @param int $maxAttempts
101101
* @param \Closure $callback
102-
* @param int $decaySeconds
102+
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
103103
* @return mixed
104104
*/
105105
public function attempt($key, $maxAttempts, Closure $callback, $decaySeconds = 60)
@@ -141,7 +141,7 @@ public function tooManyAttempts($key, $maxAttempts)
141141
* Increment (by 1) the counter for a given key for a given decay time.
142142
*
143143
* @param string $key
144-
* @param int $decaySeconds
144+
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
145145
* @return int
146146
*/
147147
public function hit($key, $decaySeconds = 60)
@@ -153,7 +153,7 @@ public function hit($key, $decaySeconds = 60)
153153
* Increment the counter for a given key for a given decay time by a given amount.
154154
*
155155
* @param string $key
156-
* @param int $decaySeconds
156+
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
157157
* @param int $amount
158158
* @return int
159159
*/
@@ -184,7 +184,7 @@ public function increment($key, $decaySeconds = 60, $amount = 1)
184184
* Decrement the counter for a given key for a given decay time by a given amount.
185185
*
186186
* @param string $key
187-
* @param int $decaySeconds
187+
* @param \DateTimeInterface|\DateInterval|int $decaySeconds
188188
* @param int $amount
189189
* @return int
190190
*/

src/Illuminate/Cache/RedisTaggedCache.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Illuminate\Cache;
44

5+
use Illuminate\Cache\Events\CacheFlushed;
6+
use Illuminate\Cache\Events\CacheFlushing;
7+
58
class RedisTaggedCache extends TaggedCache
69
{
710
/**
@@ -105,9 +108,13 @@ public function forever($key, $value)
105108
*/
106109
public function flush()
107110
{
111+
$this->event(new CacheFlushing($this->getName()));
112+
108113
$this->flushValues();
109114
$this->tags->flush();
110115

116+
$this->event(new CacheFlushed($this->getName()));
117+
111118
return true;
112119
}
113120

src/Illuminate/Cache/Repository.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Closure;
88
use DateTimeInterface;
99
use Illuminate\Cache\Events\CacheFlushed;
10+
use Illuminate\Cache\Events\CacheFlushFailed;
1011
use Illuminate\Cache\Events\CacheFlushing;
1112
use Illuminate\Cache\Events\CacheHit;
1213
use Illuminate\Cache\Events\CacheMissed;
@@ -584,6 +585,8 @@ public function clear(): bool
584585

585586
if ($result) {
586587
$this->event(new CacheFlushed($this->getName()));
588+
} else {
589+
$this->event(new CacheFlushFailed($this->getName()));
587590
}
588591

589592
return $result;

src/Illuminate/Cache/TaggedCache.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Illuminate\Cache;
44

5+
use Illuminate\Cache\Events\CacheFlushed;
6+
use Illuminate\Cache\Events\CacheFlushing;
57
use Illuminate\Contracts\Cache\Store;
68

79
class TaggedCache extends Repository
@@ -77,8 +79,12 @@ public function decrement($key, $value = 1)
7779
*/
7880
public function flush()
7981
{
82+
$this->event(new CacheFlushing($this->getName()));
83+
8084
$this->tags->reset();
8185

86+
$this->event(new CacheFlushed($this->getName()));
87+
8288
return true;
8389
}
8490

@@ -104,7 +110,7 @@ public function taggedItemKey($key)
104110
/**
105111
* Fire an event for this cache instance.
106112
*
107-
* @param \Illuminate\Cache\Events\CacheEvent $event
113+
* @param object $event
108114
* @return void
109115
*/
110116
protected function event($event)

src/Illuminate/Collections/Arr.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,19 @@ public static function dot($array, $prepend = '')
112112
{
113113
$results = [];
114114

115-
foreach ($array as $key => $value) {
116-
if (is_array($value) && ! empty($value)) {
117-
$results = array_merge($results, static::dot($value, $prepend.$key.'.'));
118-
} else {
119-
$results[$prepend.$key] = $value;
115+
$flatten = function ($data, $prefix) use (&$results, &$flatten): void {
116+
foreach ($data as $key => $value) {
117+
$newKey = $prefix.$key;
118+
119+
if (is_array($value) && ! empty($value)) {
120+
$flatten($value, $newKey.'.');
121+
} else {
122+
$results[$newKey] = $value;
123+
}
120124
}
121-
}
125+
};
126+
127+
$flatten($array, $prepend);
122128

123129
return $results;
124130
}

0 commit comments

Comments
 (0)