Upgrade to 3.6.0
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user