|
|
|
|
@ -31,16 +31,15 @@ class InplaceMediaProcessor {
|
|
|
|
|
: $this->fileSystem->copy($source, $dest, FileExists::Rename); |
|
|
|
|
|
|
|
|
|
$fileEntity = $this->fileRepository->loadByUri($uri) |
|
|
|
|
?? File::create(['uri' => $uri, 'status' => 1]); |
|
|
|
|
|
|
|
|
|
?? File::create(['uri' => $uri, 'status' => 1, 'uid' => 1]); |
|
|
|
|
$fileEntity->save(); |
|
|
|
|
|
|
|
|
|
preg_match('/^(\d+)_/', $file, $m); |
|
|
|
|
$nid = $m[1] ?? NULL; |
|
|
|
|
|
|
|
|
|
Media::create([ |
|
|
|
|
'bundle' => $opts['media_type'], |
|
|
|
|
'name' => $file, |
|
|
|
|
'uid' => 1, |
|
|
|
|
$opts['file_type'] => ['target_id' => $fileEntity->id()], |
|
|
|
|
'field_media_use' => ['target_id' => $opts['media_use']], |
|
|
|
|
'field_media_of' => $nid, |
|
|
|
|
|