Upgrade to 3.8.3
This commit is contained in:
@@ -31,7 +31,7 @@ trait PageActions
|
||||
* Adapts necessary modifications which page uuid, page slug and files uuid
|
||||
* of copy objects for single or multilang environments
|
||||
*/
|
||||
protected function adaptCopy(Page $copy, bool $files = false): Page
|
||||
protected function adaptCopy(Page $copy, bool $files = false, bool $children = false): Page
|
||||
{
|
||||
if ($this->kirby()->multilang() === true) {
|
||||
foreach ($this->kirby()->languages() as $language) {
|
||||
@@ -43,11 +43,21 @@ trait PageActions
|
||||
) {
|
||||
$copy = $copy->save(['uuid' => Uuid::generate()], $language->code());
|
||||
|
||||
// regenerate UUIDs of page files
|
||||
if ($files !== false) {
|
||||
foreach ($copy->files() as $file) {
|
||||
$file->save(['uuid' => Uuid::generate()], $language->code());
|
||||
}
|
||||
}
|
||||
|
||||
// regenerate UUIDs of all page children
|
||||
if ($children !== false) {
|
||||
foreach ($copy->index(true) as $child) {
|
||||
// always adapt files of subpages as they are currently always copied;
|
||||
// but don't adapt children because we already operate on the index
|
||||
$this->adaptCopy($child, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove all translated slugs
|
||||
@@ -66,11 +76,21 @@ trait PageActions
|
||||
if (Uuids::enabled() === true) {
|
||||
$copy = $copy->save(['uuid' => Uuid::generate()]);
|
||||
|
||||
// regenerate UUIDs of page files
|
||||
if ($files !== false) {
|
||||
foreach ($copy->files() as $file) {
|
||||
$file->save(['uuid' => Uuid::generate()]);
|
||||
}
|
||||
}
|
||||
|
||||
// regenerate UUIDs of all page children
|
||||
if ($children !== false) {
|
||||
foreach ($copy->index(true) as $child) {
|
||||
// always adapt files of subpages as they are currently always copied;
|
||||
// but don't adapt children because we already operate on the index
|
||||
$this->adaptCopy($child, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $copy;
|
||||
@@ -484,7 +504,7 @@ trait PageActions
|
||||
$copy = $parentModel->clone()->findPageOrDraft($slug);
|
||||
|
||||
// normalize copy object
|
||||
$copy = $this->adaptCopy($copy, $files);
|
||||
$copy = $this->adaptCopy($copy, $files, $children);
|
||||
|
||||
// add copy to siblings
|
||||
static::updateParentCollections($copy, 'append', $parentModel);
|
||||
|
||||
Reference in New Issue
Block a user