mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-22 08:56:31 +01:00
Merge branch 'dev' of ssh://gitlab.werkraum-media.de:21512/typo3/events into dev
This commit is contained in:
commit
f2973a4a99
1 changed files with 16 additions and 5 deletions
|
@ -565,21 +565,32 @@ class DestinationDataImportService {
|
||||||
|
|
||||||
$this->storage = $this->resourceFactory->getDefaultStorage();
|
$this->storage = $this->resourceFactory->getDefaultStorage();
|
||||||
|
|
||||||
|
$orgFileUrl = urldecode($media_object['url']);
|
||||||
|
$orgFileNameSanitized = $this->storage->sanitizeFileName(
|
||||||
|
basename(
|
||||||
|
urldecode($media_object['url'])
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->logger->info('File attached:' . $orgFileUrl);
|
||||||
|
$this->logger->info('File attached sanitized:' . $orgFileNameSanitized);
|
||||||
|
//die();
|
||||||
|
|
||||||
if ($this->storage == null) {
|
if ($this->storage == null) {
|
||||||
$this->logger->error('No default storage defined. Cancel import.');
|
$this->logger->error('No default storage defined. Cancel import.');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if file already exists
|
// Check if file already exists
|
||||||
if (file_exists($this->environment->getPublicPath() . '/fileadmin/' . $this->filesFolder . strtolower(basename($media_object['url'])))) {
|
if (file_exists($this->environment->getPublicPath() . '/fileadmin/' . $this->filesFolder . $orgFileNameSanitized)) {
|
||||||
$this->logger->info('File already exists');
|
$this->logger->info('File already exists');
|
||||||
} else {
|
} else {
|
||||||
$this->logger->info("File don't exist");
|
$this->logger->info("File don't exist " . $orgFileNameSanitized);
|
||||||
// Load the file
|
// Load the file
|
||||||
if ($file = $this->loadFile($media_object['url'])) {
|
if ($file = $this->loadFile($orgFileUrl)) {
|
||||||
// Move file to defined folder
|
// Move file to defined folder
|
||||||
$this->logger->info('Adding file ' . $file);
|
$this->logger->info('Adding file ' . $file);
|
||||||
$this->storage->addFile($this->environment->getPublicPath() . "/uploads/tx_events/" . $file, $this->storage->getFolder($this->filesFolder), basename($media_object['url']));
|
$this->storage->addFile($this->environment->getPublicPath() . "/uploads/tx_events/" . $file, $this->storage->getFolder($this->filesFolder));
|
||||||
} else {
|
} else {
|
||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
|
@ -591,7 +602,7 @@ class DestinationDataImportService {
|
||||||
// TODO: How to delete file references?
|
// TODO: How to delete file references?
|
||||||
} else {
|
} else {
|
||||||
$this->logger->info('No relation found');
|
$this->logger->info('No relation found');
|
||||||
$file = $this->storage->getFile($this->filesFolder . basename($media_object['url']));
|
$file = $this->storage->getFile($this->filesFolder . $orgFileNameSanitized);
|
||||||
$this->metaDataRepository->update($file->getUid(), array('title' => $media_object['value'], 'description' => $media_object['description'], 'alternative' => 'DD Import'));
|
$this->metaDataRepository->update($file->getUid(), array('title' => $media_object['value'], 'description' => $media_object['description'], 'alternative' => 'DD Import'));
|
||||||
$this->createFileRelations($file->getUid(), 'tx_events_domain_model_event', $this->tmpCurrentEvent->getUid(), 'images', $this->storagePid);
|
$this->createFileRelations($file->getUid(), 'tx_events_domain_model_event', $this->tmpCurrentEvent->getUid(), 'images', $this->storagePid);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue