Skip to content

Commit edf10a8

Browse files
committed
Fix: more
1 parent 00e6f45 commit edf10a8

File tree

1 file changed

+0
-58
lines changed

1 file changed

+0
-58
lines changed

Receiver.php

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -567,64 +567,6 @@ public function handlerCatalogModeFile()
567567

568568
$response_description = __('The data is successfully written to a file. Recorded data size:', 'wc1c') . ' '. size_format($file_size);
569569

570-
/*
571-
* Adding to media library
572-
*/
573-
if(is_file($upload_file_path) && 'yes' === $this->core()->getOptions('media_library_images_by_receiver', 'no'))
574-
{
575-
if('yes' !== $this->core()->getOptions('media_library', 'no'))
576-
{
577-
$this->core()->log()->notice(__('The file was not saved to the media library. Adding is disabled in the settings.', 'wc1c'));
578-
}
579-
else
580-
{
581-
$image = wp_get_image_mime($upload_file_path);
582-
if($image)
583-
{
584-
/** @var ImagesStorageContract */
585-
$images_storage = Storage::load('image');
586-
587-
$image_file_name = explode('.', basename($upload_file_path));
588-
589-
$image_current = $images_storage->getByExternalName($image_file_name[0]);
590-
if(is_array($image_current))
591-
{
592-
$image_current = $image_current[0];
593-
}
594-
595-
if(false === $image_current)
596-
{
597-
$new_image = new Image();
598-
599-
$new_image->setName(__('No name', 'wc1c'));
600-
$new_image->setExternalName($image_file_name[0]);
601-
$new_image->setSlug($image_file_name[0]);
602-
603-
$new_image->setConfigurationId($this->core()->configuration()->getId());
604-
$new_image->setSchemaId($this->core()->getId());
605-
606-
$new_image->setUserId($this->core()->configuration()->getUserId());
607-
$new_image->setMimeType($image);
608-
609-
$image_id = $images_storage->uploadByPath($upload_file_path, $new_image);
610-
611-
if($image_id === false)
612-
{
613-
$response_description .= '. ' . __('The image has not been added to the media library.', 'wc1c');
614-
}
615-
else
616-
{
617-
$response_description .= '. ' . __('Image added to media library, id:', 'wc1c') . ' ' . $image_id;
618-
}
619-
}
620-
else
621-
{
622-
$response_description .= '. ' . __('The image has not been added to the media library. It was added earlier, id:', 'wc1c') . ' ' . $image_current->getId();
623-
}
624-
}
625-
}
626-
}
627-
628570
$this->core()->log()->info($response_description, ['file_size' => $file_size]);
629571
$this->sendResponseByType('success', $response_description);
630572
return;

0 commit comments

Comments
 (0)