Skip to content

Commit 8b8e61e

Browse files
committed
Merge branch '2.4-develop' into L3_PR_21-12-10
2 parents 42a3cbf + 6bbf0aa commit 8b8e61e

File tree

1 file changed

+24
-26
lines changed

1 file changed

+24
-26
lines changed

app/code/Magento/ImportExport/Model/Import.php

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -51,79 +51,77 @@
5151
*/
5252
class Import extends AbstractModel
5353
{
54-
const BEHAVIOR_APPEND = 'append';
55-
const BEHAVIOR_ADD_UPDATE = 'add_update';
56-
const BEHAVIOR_REPLACE = 'replace';
57-
const BEHAVIOR_DELETE = 'delete';
58-
const BEHAVIOR_CUSTOM = 'custom';
54+
public const BEHAVIOR_APPEND = 'append';
55+
public const BEHAVIOR_ADD_UPDATE = 'add_update';
56+
public const BEHAVIOR_REPLACE = 'replace';
57+
public const BEHAVIOR_DELETE = 'delete';
58+
public const BEHAVIOR_CUSTOM = 'custom';
5959

6060
/**
6161
* Import source file.
6262
*/
63-
const FIELD_NAME_SOURCE_FILE = 'import_file';
63+
public const FIELD_NAME_SOURCE_FILE = 'import_file';
6464

6565
/**
6666
* Import image archive.
6767
*/
68-
const FIELD_NAME_IMG_ARCHIVE_FILE = 'import_image_archive';
68+
public const FIELD_NAME_IMG_ARCHIVE_FILE = 'import_image_archive';
6969

7070
/**
7171
* Import images file directory.
7272
*/
73-
const FIELD_NAME_IMG_FILE_DIR = 'import_images_file_dir';
73+
public const FIELD_NAME_IMG_FILE_DIR = 'import_images_file_dir';
7474

7575
/**
7676
* Allowed errors count field name
7777
*/
78-
const FIELD_NAME_ALLOWED_ERROR_COUNT = 'allowed_error_count';
78+
public const FIELD_NAME_ALLOWED_ERROR_COUNT = 'allowed_error_count';
7979

8080
/**
8181
* Validation startegt field name
8282
*/
83-
const FIELD_NAME_VALIDATION_STRATEGY = 'validation_strategy';
83+
public const FIELD_NAME_VALIDATION_STRATEGY = 'validation_strategy';
8484

8585
/**
8686
* Import field separator.
8787
*/
88-
const FIELD_FIELD_SEPARATOR = '_import_field_separator';
88+
public const FIELD_FIELD_SEPARATOR = '_import_field_separator';
8989

9090
/**
9191
* Import multiple value separator.
9292
*/
93-
const FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR = '_import_multiple_value_separator';
93+
public const FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR = '_import_multiple_value_separator';
9494

9595
/**
9696
* Import empty attribute value constant.
9797
*/
98-
const FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT = '_import_empty_attribute_value_constant';
98+
public const FIELD_EMPTY_ATTRIBUTE_VALUE_CONSTANT = '_import_empty_attribute_value_constant';
9999

100100
/**
101101
* Allow multiple values wrapping in double quotes for additional attributes.
102102
*/
103-
const FIELDS_ENCLOSURE = 'fields_enclosure';
103+
public const FIELDS_ENCLOSURE = 'fields_enclosure';
104104

105105
/**
106106
* default delimiter for several values in one cell as default for FIELD_FIELD_MULTIPLE_VALUE_SEPARATOR
107107
*/
108-
const DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR = ',';
108+
public const DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR = ',';
109109

110110
/**
111111
* Import empty attribute default value
112112
*/
113-
const DEFAULT_EMPTY_ATTRIBUTE_VALUE_CONSTANT = '__EMPTY__VALUE__';
114-
const DEFAULT_SIZE = 50;
115-
const MAX_IMPORT_CHUNKS = 4;
116-
const IMPORT_HISTORY_DIR = 'import_history/';
117-
const IMPORT_DIR = 'import/';
113+
public const DEFAULT_EMPTY_ATTRIBUTE_VALUE_CONSTANT = '__EMPTY__VALUE__';
114+
public const DEFAULT_SIZE = 50;
115+
public const MAX_IMPORT_CHUNKS = 4;
116+
public const IMPORT_HISTORY_DIR = 'import_history/';
117+
public const IMPORT_DIR = 'import/';
118118

119119
/**
120120
* @var AbstractEntity|ImportAbstractEntity
121121
*/
122122
protected $_entityAdapter;
123123

124124
/**
125-
* Import export data
126-
*
127125
* @var DataHelper
128126
*/
129127
protected $_importExportData = null;
@@ -134,7 +132,6 @@ class Import extends AbstractModel
134132
private $_coreConfig;
135133

136134
/**
137-
* @var \Magento\ImportExport\Model\Import\ConfigInterface
138135
* @var ConfigInterface
139136
*/
140137
protected $_importConfig;
@@ -577,7 +574,7 @@ public function uploadSource()
577574
throw new LocalizedException(__('The file cannot be uploaded.'));
578575
}
579576

580-
// phpcs:disable Magento2.Functions.DiscouragedFunction.Discouraged
577+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
581578
$extension = pathinfo($result['file'], PATHINFO_EXTENSION);
582579

583580
$uploadedFile = $result['path'] . $result['file'];
@@ -638,10 +635,11 @@ public function uploadFileAndGetSource()
638635
*/
639636
protected function _removeBom($sourceFile)
640637
{
641-
$string = $this->_varDirectory->readFile($this->_varDirectory->getRelativePath($sourceFile));
638+
$driver = $this->_varDirectory->getDriver();
639+
$string = $driver->fileGetContents($this->_varDirectory->getAbsolutePath($sourceFile));
642640
if ($string !== false && substr($string, 0, 3) == pack("CCC", 0xef, 0xbb, 0xbf)) {
643641
$string = substr($string, 3);
644-
$this->_varDirectory->writeFile($this->_varDirectory->getRelativePath($sourceFile), $string);
642+
$driver->filePutContents($this->_varDirectory->getAbsolutePath($sourceFile), $string);
645643
}
646644
return $this;
647645
}

0 commit comments

Comments
 (0)