Skip to content

Commit f7dd8d1

Browse files
Upgrade to 3.6.5
1 parent 30ee49e commit f7dd8d1

30 files changed

+266
-279
lines changed

kirby/.vscode/extensions.json

-6
This file was deleted.

kirby/.vscode/settings.json

-4
This file was deleted.

kirby/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Please post all bug reports in our [issue tracker](https://github.com/getkirby/k
2828
If you have ideas for a feature or enhancement for Kirby, please use our [feedback platform](https://feedback.getkirby.com).
2929

3030
**Translations, bug fixes, code contributions ...**
31-
Read about how to contribute to the development in our [contributing guide](/.github/CONTRIBUTING.md).
31+
Read about how to contribute to the development in our [contributing guide](/CONTRIBUTING.md).
3232

3333

3434

kirby/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "The Kirby 3 core",
44
"license": "proprietary",
55
"type": "kirby-cms",
6-
"version": "3.6.4",
6+
"version": "3.6.5",
77
"keywords": [
88
"kirby",
99
"cms",

kirby/composer.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kirby/config/methods.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@
112112
* Converts the field value to a timestamp or a formatted date
113113
*
114114
* @param \Kirby\Cms\Field $field
115-
* @param string|null $format PHP date formatting string
115+
* @param string|\IntlDateFormatter|null $format PHP date formatting string
116116
* @param string|null $fallback Fallback string for `strtotime` (since 3.2)
117117
* @return string|int
118118
*/
119-
'toDate' => function (Field $field, string $format = null, string $fallback = null) use ($app) {
119+
'toDate' => function (Field $field, $format = null, string $fallback = null) use ($app) {
120120
if (empty($field->value) === true && $fallback === null) {
121121
return null;
122122
}

kirby/i18n/translations/fr.json

+69-69
Large diffs are not rendered by default.

kirby/i18n/translations/nl.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157

158158
"error.template.default.notFound": "Het standaard template bestaat niet",
159159

160-
"error.unexpected": "An unexpected error occurred! Enable debug mode for more info: https://getkirby.com/docs/reference/system/options/debug",
160+
"error.unexpected": "Een onverwacht fout heeft plaats gevonden! Schakel debug-modus in voor meer informatie: https://getkirby.com/docs/reference/system/options/debug",
161161

162162
"error.user.changeEmail.permission": "Je hebt geen rechten om het e-mailadres van gebruiker \"{name}\" te wijzigen",
163163
"error.user.changeLanguage.permission": "Je hebt geen rechten om de taal voor gebruiker \"{name}\" te wijzigen",

kirby/panel/.eslintrc.js

-22
This file was deleted.

kirby/panel/.prettierrc.json

-3
This file was deleted.

kirby/panel/dist/css/style.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kirby/panel/vite.config.js

-115
This file was deleted.

kirby/panel/vitest.setup.js

-4
This file was deleted.

kirby/src/Cms/App.php

+14-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Kirby\Filesystem\Dir;
1111
use Kirby\Filesystem\F;
1212
use Kirby\Http\Request;
13+
use Kirby\Http\Response;
1314
use Kirby\Http\Router;
1415
use Kirby\Http\Server;
1516
use Kirby\Http\Uri;
@@ -709,14 +710,25 @@ public function io($input)
709710
return $this->io(new NotFoundException());
710711
}
711712

712-
// Response Configuration
713+
// (Modified) global response configuration, e.g. in routes
713714
if (is_a($input, 'Kirby\Cms\Responder') === true) {
715+
// return the passed object unmodified (without injecting headers
716+
// from the global object) to allow a complete response override
717+
// https://github.com/getkirby/kirby/pull/4144#issuecomment-1034766726
714718
return $input->send();
715719
}
716720

717721
// Responses
718722
if (is_a($input, 'Kirby\Http\Response') === true) {
719-
return $input;
723+
$data = $input->toArray();
724+
725+
// inject headers from the global response configuration
726+
// lazily (only if they are not already set);
727+
// the case-insensitive nature of headers will be
728+
// handled by PHP's `header()` function
729+
$data['headers'] = array_merge($response->headers(), $data['headers']);
730+
731+
return new Response($data);
720732
}
721733

722734
// Pages

kirby/src/Cms/File.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,12 @@ public function mediaUrl(): string
353353
/**
354354
* Get the file's last modification time.
355355
*
356-
* @param string|null $format
357-
* @param string|null $handler date or strftime
356+
* @param string|\IntlDateFormatter|null $format
357+
* @param string|null $handler date, intl or strftime
358358
* @param string|null $languageCode
359359
* @return mixed
360360
*/
361-
public function modified(string $format = null, string $handler = null, string $languageCode = null)
361+
public function modified($format = null, string $handler = null, string $languageCode = null)
362362
{
363363
$file = $this->modifiedFile();
364364
$content = $this->modifiedContent($languageCode);

kirby/src/Cms/FileRules.php

+22-7
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,30 @@ public static function changeSort(File $file, int $sort): bool
8080
*/
8181
public static function create(File $file, BaseFile $upload): bool
8282
{
83+
// We want to ensure that we are not creating duplicate files.
84+
// If a file with the same name already exists
8385
if ($file->exists() === true) {
84-
if ($file->sha1() !== $upload->sha1()) {
85-
throw new DuplicateException([
86-
'key' => 'file.duplicate',
87-
'data' => [
88-
'filename' => $file->filename()
89-
]
90-
]);
86+
// $file will be based on the props of the new file,
87+
// to compare templates, we need to get the props of
88+
// the already existing file from meta content file
89+
$existing = $file->parent()->file($file->filename());
90+
91+
// if the new upload is the exact same file
92+
// and uses the same template, we can continue
93+
if (
94+
$file->sha1() === $upload->sha1() &&
95+
$file->template() === $existing->template()
96+
) {
97+
return true;
9198
}
99+
100+
// otherwise throw an error for duplicate file
101+
throw new DuplicateException([
102+
'key' => 'file.duplicate',
103+
'data' => [
104+
'filename' => $file->filename()
105+
]
106+
]);
92107
}
93108

94109
if ($file->permissions()->create() !== true) {

kirby/src/Database/Query.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,11 @@ public function page(int $page, int $limit)
775775

776776
// apply it to the dataset and retrieve all rows. make sure to use Collection as the iterator to be able to attach the pagination object
777777
$iterator = $this->iterator;
778-
$collection = $this->offset($pagination->offset())->limit($pagination->limit())->iterator('Collection')->all();
778+
$collection = $this
779+
->offset($pagination->offset())
780+
->limit($pagination->limit())
781+
->iterator('Kirby\Toolkit\Collection')
782+
->all();
779783

780784
$this->iterator($iterator);
781785

@@ -968,6 +972,11 @@ protected function filterQuery(array $args, $current)
968972
$this->bindings($sql['bindings']);
969973
} elseif (is_callable($args[0]) === true) {
970974
$query = clone $this;
975+
976+
// since the callback uses its own where condition
977+
// it is necessary to clear/reset the cloned where condition
978+
$query->where = null;
979+
971980
call_user_func($args[0], $query);
972981

973982
// copy over the bindings from the nested query

kirby/src/Database/Sql.php

+12-2
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,14 @@ public function valueList(string $table, $values, string $separator = ',', bool
853853
$query = [];
854854
$bindings = [];
855855

856-
foreach ($values as $key => $value) {
857-
$fields[] = $this->columnName($table, $key, $enforceQualified);
856+
foreach ($values as $column => $value) {
857+
$key = $this->columnName($table, $column, $enforceQualified);
858+
859+
if ($key === null) {
860+
continue;
861+
}
862+
863+
$fields[] = $key;
858864

859865
if (in_array($value, static::$literals, true) === true) {
860866
$query[] = $value ?: 'null';
@@ -896,6 +902,10 @@ public function valueSet(string $table, $values, string $separator = ',', bool $
896902
foreach ($values as $column => $value) {
897903
$key = $this->columnName($table, $column, $enforceQualified);
898904

905+
if ($key === null) {
906+
continue;
907+
}
908+
899909
if (in_array($value, static::$literals, true) === true) {
900910
$query[] = $key . ' = ' . ($value ?: 'null');
901911
continue;

kirby/src/Database/Sql/Sqlite.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function quoteIdentifier(string $identifier): string
137137
public function tables(): array
138138
{
139139
return [
140-
'query' => 'SELECT name FROM sqlite_master WHERE type = "table"',
140+
'query' => 'SELECT name FROM sqlite_master WHERE type = "table" OR type = "view"',
141141
'bindings' => []
142142
];
143143
}

kirby/src/Filesystem/F.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,11 @@ public static function mimeToType(string $mime)
463463
* Get the file's last modification time.
464464
*
465465
* @param string $file
466-
* @param string $format
467-
* @param string $handler date or strftime
466+
* @param string|\IntlDateFormatter|null $format
467+
* @param string $handler date, intl or strftime
468468
* @return mixed
469469
*/
470-
public static function modified(string $file, string $format = null, string $handler = 'date')
470+
public static function modified(string $file, $format = null, string $handler = 'date')
471471
{
472472
if (file_exists($file) !== true) {
473473
return false;

kirby/src/Filesystem/File.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,11 @@ public function mime()
372372
/**
373373
* Returns the file's last modification time
374374
*
375-
* @param string $format
376-
* @param string|null $handler date or strftime
375+
* @param string|\IntlDateFormatter|null $format
376+
* @param string|null $handler date, intl or strftime
377377
* @return mixed
378378
*/
379-
public function modified(?string $format = null, ?string $handler = null)
379+
public function modified($format = null, ?string $handler = null)
380380
{
381381
$kirby = $this->kirby();
382382

0 commit comments

Comments
 (0)