Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(STEUN-409): change php requirements #36

Merged
merged 5 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
"name": "honl/magento2-import",
"description": "",
"require": {
"php": "~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0",
"php": "~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.2",
"guzzlehttp/guzzle": "^7",
"prewk/xml-string-streamer": "^1.2",
"prewk/xml-string-streamer-guzzle": "^1.2",
"kevinrob/guzzle-cache-middleware": "^4",
"ecomdev/magento-psr6-bridge": "^0.2.1",
"symfony/stopwatch": "~4.0",
"symfony/stopwatch": "^v6.2",
"bakame/psr7-csv-factory": "^1.0@dev",
"league/csv": "^9.1",
"monolog/monolog": "^2.8"
"monolog/monolog": "^2.8",
"ext-mbstring": "*"
},
"type": "magento2-module",
"autoload": {
Expand Down
9 changes: 5 additions & 4 deletions src/Console/Command/CronScheduleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function configure()
*
* @throws \Magento\Framework\Exception\AlreadyExistsException
*
* @return void
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -100,7 +100,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

if (! $job) {
$output->writeln("<error>".((string) new Phrase("Job not found"))."</error>");
return;
return 0;
}


Expand All @@ -109,7 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(
(string) new Phrase("Job is already %1", ["<error>".$existingJob->getStatus()."</error>"])
);
return;
return 0;
}

try {
Expand All @@ -121,7 +121,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
[$ahead]
)
."</error>");
return;
return 0;
}

$jobSchedule = $this->generateSchedule($job, $ahead);
Expand All @@ -130,6 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$jobSchedule->getResource()->save($jobSchedule);
$output->writeln("<info>".((string) new Phrase("Job scheduled"))."</info>");
return 0;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Console/Command/HoImportRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function configure()
* @param InputInterface $input
* @param OutputInterface $output
*
* @return void
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand All @@ -104,11 +104,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!isset($profiles[$profile])) {
$profileList = implode(", ", array_keys($profiles));
$output->writeln((string) new Phrase("<error>Profile not in profilelist: %1</error>", [$profileList]));
return;
return 0;
}

$profileInstance = $profiles[$profile];
$profileInstance->run();
return 0;
}


Expand Down
2 changes: 1 addition & 1 deletion src/RowModifier/ExternalCategoryManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,6 @@ private function extractCategoriesFromString($categories)
{
return array_filter(array_map(function ($category) {
return trim($category, " \t\n\r\0\x0B/");
}, explode(',', trim($categories, " \t\n\r\0\x0B/"))));
}, explode(',', trim($categories ?? '', " \t\n\r\0\x0B/"))));
}
}
7 changes: 6 additions & 1 deletion src/Streamer/FileCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function getIterator()
$csvReader->setDelimiter($this->delimiter);
}
foreach ($csvReader->getIterator() as $row) {
yield (empty($this->headers) ? $row : \array_combine($this->headers, \array_map('utf8_encode', $row)));
yield (empty($this->headers) ? $row : \array_combine($this->headers, \array_map(self::class . '::convert_encoding', $row)));
}
}

Expand All @@ -112,4 +112,9 @@ private function getRequestFile(): string
? $this->requestFile
: $this->directoryList->getRoot() . '/' . trim($this->requestFile, '/');
}

public function convert_encoding($row)
{
return mb_convert_encoding($row, 'UTF-8', 'ISO-8859-1');
}
}