Skip to content

Commit

Permalink
Merge branch 'master' into virtualcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
rommmka committed Mar 30, 2023
2 parents f1201c6 + de52169 commit 3420534
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
2 changes: 0 additions & 2 deletions Console/Command/ModuleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ protected function execute(InputInterface $input, OutputInterface $output)

$moduleModel = $this->moduleFactory->create();
$moduleModel->load($moduleCode);
// \Zend_Debug::dump($moduleModel->getData());

$identityKey = $moduleModel->getData('identity_key');
if (!empty($identityKey)) {
Expand All @@ -163,7 +162,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$table = new Table($output);
// $table->setHeaders(['Param', 'Value']);
$table->setRows($rows);
// \Zend_Debug::dump($items[$moduleCode]);
$table->render();
}
}
20 changes: 9 additions & 11 deletions Model/ComponentList/Loader/Remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Remote extends AbstractLoader
protected $jsonHelper;

/**
* @var \Magento\Framework\HTTP\ZendClientFactory
* @var \Magento\Framework\HTTP\ClientFactory
*/
protected $httpClientFactory;

Expand All @@ -40,15 +40,15 @@ class Remote extends AbstractLoader
* @param \Magento\Framework\App\RequestInterface $request
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Framework\Json\Helper\Data $jsonHelper
* @param \Magento\Framework\HTTP\ZendClientFactory $httpClientFactory
* @param \Magento\Framework\HTTP\ClientFactory $httpClientFactory
*/
public function __construct(
\Swissup\Core\Helper\Component $componentHelper,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\App\RequestInterface $request,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Framework\Json\Helper\Data $jsonHelper,
\Magento\Framework\HTTP\ZendClientFactory $httpClientFactory,
\Magento\Framework\HTTP\ClientFactory $httpClientFactory,
\Magento\Framework\App\CacheInterface $cache
) {
parent::__construct($componentHelper, $logger);
Expand Down Expand Up @@ -111,7 +111,7 @@ public function getComponentsInfo()
$carry = $item;
}
return $carry;
}, 0);
}, $versions[0] ?? 0);
if (!empty($info[$latestVersion]['type']) &&
$info[$latestVersion]['type'] === 'metapackage') {

Expand Down Expand Up @@ -154,13 +154,11 @@ public function getComponentsInfo()
protected function fetch($url)
{
$client = $this->httpClientFactory->create();
$client->setUri($url);
$client->setConfig([
'maxredirects' => 5,
'timeout' => 30
]);
$client->setParameterGet('domain', $this->request->getHttpHost());
return $client->request()->getBody();
$client->setOption(CURLOPT_FOLLOWLOCATION, true);
$client->setOption(CURLOPT_MAXREDIRS, 5);
$client->setTimeout(30);
$client->get($url);
return $client->getBody();
}

/**
Expand Down
10 changes: 6 additions & 4 deletions Model/Module/LicenseValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,18 @@ public function validate()

try {
$client = $this->curlFactory->create();
$client->setConfig(['maxredirects'=>5, 'timeout'=>30]);
$client->setConfig(['maxredirects' => 5, 'timeout' =>30]);
$client->write(
\Zend_Http_Client::GET,
\Laminas\Http\Request::METHOD_GET,
$this->getUrl($site, [
'key' => $secret,
'suffix' => $suffix,
])
);
$responseBody = $client->read();
$responseBody = \Zend_Http_Response::extractBody($responseBody);
$responseString = $client->read();
$responseParts = preg_split('|(?:\r\n){2}|m', $responseString, 2);
$responseBody = trim($responseParts[1] ?? '');

$client->close();
} catch (\Exception $e) {
return [
Expand Down
3 changes: 3 additions & 0 deletions Plugin/SetEmptyStringIfOutputEmpty.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ public function afterToHtml(
\Magento\Framework\View\Element\AbstractBlock $subject,
$resultHtml
) {
if (!is_string($resultHtml)) {
return $resultHtml;
}
$html = trim($resultHtml, " \n");
return empty($html) ? $html : $resultHtml;
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "swissup/module-core",
"description": "Swissup core module. It's purpose is to add Swissup menu and config entries",
"type": "magento2-module",
"version": "1.12.12",
"version": "1.12.14",
"license": "OSL-3.0",
"autoload": {
"files": [ "registration.php" ],
Expand Down

1 comment on commit 3420534

@ci-swissuplabs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! All tests are passed!

Please sign in to comment.