Skip to content

Commit

Permalink
Merge pull request #32 from PrestaShop/dev
Browse files Browse the repository at this point in the history
Release 1.1.1
  • Loading branch information
M0rgan01 authored Jan 19, 2024
2 parents 720b7a6 + 3f72bf7 commit 4db438b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

Download & upgrade PrestaShop's native modules from your backoffice

## Compatibility

PrestaShop: `8.0.2` or later

## Reporting issues

You can report issues with this module in the main PrestaShop repository. [Click here to report an issue][report-issue].
Expand Down Expand Up @@ -32,6 +36,6 @@ Just make sure to follow our [contribution guidelines][contribution-guidelines].
This module is released under the [Academic Free License 3.0][AFL-3.0]

[report-issue]: https://github.com/PrestaShop/PrestaShop/issues/new/choose
[prestashop]: https://www.prestashop.com/
[contribution-guidelines]: https://devdocs.prestashop.com/1.7/contribute/contribution-guidelines/project-modules/
[prestashop]: https://www.prestashop-project.org/
[contribution-guidelines]: https://devdocs.prestashop-project.org/8/contribute/contribution-guidelines/project-modules/
[AFL-3.0]: https://opensource.org/licenses/AFL-3.0
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>ps_distributionapiclient</name>
<displayName><![CDATA[Distribution API Client]]></displayName>
<version><![CDATA[1.1.0]]></version>
<version><![CDATA[1.1.1]]></version>
<description><![CDATA[Download and upgrade PrestaShop&#039;s native modules.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[market_place]]></tab>
Expand Down
3 changes: 2 additions & 1 deletion config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ services:
- '%ps_cache_dir%/distribution-api'

distributionapiclient.cache.provider:
class: Symfony\Component\Cache\DoctrineProvider
class: Doctrine\Common\Cache\Psr6\DoctrineProvider
factory: [ Doctrine\Common\Cache\Psr6\DoctrineProvider, wrap ]
arguments:
- '@distributionapiclient.cache.filesystem.adapter'

Expand Down
2 changes: 1 addition & 1 deletion ps_distributionapiclient.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct()
$this->displayName = $this->trans('Distribution API Client', [], 'Modules.Distributionapiclient.Admin');
$this->description = $this->trans('Download and upgrade PrestaShop\'s native modules.', [], 'Modules.Distributionapiclient.Admin');
$this->author = 'PrestaShop';
$this->version = '1.1.0';
$this->version = '1.1.1';
$this->ps_versions_compliancy = ['min' => '8.0.2', 'max' => _PS_VERSION_];
$this->tab = 'market_place';
parent::__construct();
Expand Down
10 changes: 7 additions & 3 deletions src/DistributionApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,13 @@ private function createDownloadDirectoryIfNeeded(string $downloadPath): void
*/
private function getResponse(string $endpoint): array
{
/** @var array<array<string, string>> $response */
$response = json_decode($this->circruitBreaker->call($endpoint), true) ?: [];
$response = $this->circruitBreaker->call($endpoint, [], function () {
throw new \PrestaShopException('Unable to retrieve informations from Distribution API : cannot automatically update native modules for the moment.');
});

return $response;
/** @var array<array<string, string>> $json */
$json = json_decode($response, true) ?: [];

return $json;
}
}
2 changes: 1 addition & 1 deletion tests/phpstan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ echo "Run PHPStan using phpstan-${PS_VERSION}.neon file"
docker run --rm --volumes-from temp-ps \
-v $PWD:/var/www/html/modules/ps_distributionapiclient \
-e _PS_ROOT_DIR_=/var/www/html \
--workdir=/var/www/html/modules/ps_distributionapiclient ghcr.io/phpstan/phpstan:1.4.10 \
--workdir=/var/www/html/modules/ps_distributionapiclient ghcr.io/phpstan/phpstan:1.7.3-php8.1 \
analyse \
--configuration=/var/www/html/modules/ps_distributionapiclient/tests/phpstan/phpstan-${PS_VERSION}.neon

0 comments on commit 4db438b

Please sign in to comment.