Upgrade to 3.6.0

This commit is contained in:
Bastian Allgeier
2021-11-16 14:53:37 +01:00
parent 7388fa4d24
commit 92b7a330fa
318 changed files with 20017 additions and 6878 deletions

View File

@@ -5,8 +5,8 @@ namespace Kirby\Cms;
use Closure;
use Kirby\Exception\InvalidArgumentException;
use Kirby\Exception\LogicException;
use Kirby\Image\Image;
use Kirby\Toolkit\F;
use Kirby\Filesystem\F;
use Kirby\Form\Form;
/**
* FileActions
@@ -75,6 +75,8 @@ trait FileActions
F::move($oldFile->contentFile(), $newFile->contentFile());
}
$newFile->parent()->files()->remove($oldFile->id());
$newFile->parent()->files()->set($newFile->id(), $newFile);
return $newFile;
});
@@ -178,7 +180,7 @@ trait FileActions
// create the basic file and a test upload object
$file = static::factory($props);
$upload = new Image($props['source']);
$upload = $file->asset($props['source']);
// create a form for the file
$form = Form::for($file, [
@@ -277,7 +279,14 @@ trait FileActions
*/
public function replace(string $source)
{
return $this->commit('replace', ['file' => $this, 'upload' => new Image($source)], function ($file, $upload) {
$file = $this->clone();
$arguments = [
'file' => $file,
'upload' => $file->asset($source)
];
return $this->commit('replace', $arguments, function ($file, $upload) {
// delete all public versions
$file->unpublish();