![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/vendor/magento/module-import-export/Model/Import/Source/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\ImportExport\Model\Import\Source; use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\ValidatorException; /** * Zip import adapter. */ class Zip extends Csv { /** * @param string $file * @param \Magento\Framework\Filesystem\Directory\Write $directory * @param string $options * @param \Magento\Framework\Archive\Zip|null $zipArchive * @throws \Magento\Framework\Exception\LocalizedException * @throws \Magento\Framework\Exception\ValidatorException */ public function __construct( $file, \Magento\Framework\Filesystem\Directory\Write $directory, $options, \Magento\Framework\Archive\Zip $zipArchive = null ) { $zip = $zipArchive ?? ObjectManager::getInstance()->get(\Magento\Framework\Archive\Zip::class); $csvFile = $zip->unpack( $file, preg_replace('/\.zip$/i', '.csv', $file) ); if (!$csvFile) { throw new ValidatorException(__('Sorry, but the data is invalid or the file is not uploaded.')); } $directory->delete($directory->getRelativePath($file)); try { parent::__construct($csvFile, $directory, $options); } catch (\LogicException $e) { $directory->delete($directory->getRelativePath($csvFile)); throw $e; } } }