Skip to content

Commit

Permalink
4.2.0 MOLIM-110 image upgrade (#194)
Browse files Browse the repository at this point in the history
* image upgrade added

* Apply php-cs-fixer changes

* phpstan unlink error fixed

* Apply php-cs-fixer changes

* annotations added

* Apply php-cs-fixer changes

* annotations fixed

* Apply php-cs-fixer changes

Co-authored-by: lukas <[email protected]>
Co-authored-by: lukvai <[email protected]>
  • Loading branch information
3 people authored Dec 18, 2020
1 parent 63c527a commit dcda5c1
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 30 deletions.
2 changes: 1 addition & 1 deletion config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
Mollie\Install\Installer:
arguments:
- '@mollie'
- '@Mollie\Service\ImageService'
- '@Mollie\Service\OrderStateImageService'
- '@Mollie\Install\DatabaseTableInstaller'

Mollie\Install\Uninstall:
Expand Down
2 changes: 1 addition & 1 deletion config/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ services:

Mollie\Service\ErrorDisplayService:

Mollie\Service\ImageService:
Mollie\Service\OrderStateImageService:

Mollie\Service\CountryService:
arguments:
Expand Down
Binary file modified logo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/Install/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
use Language;
use Mollie;
use Mollie\Config\Config;
use Mollie\Service\ImageService;
use Mollie\Service\OrderStateImageService;
use Mollie\Utility\MultiLangUtility;
use OrderState;
use PrestaShopDatabaseException;
Expand All @@ -69,7 +69,7 @@ class Installer implements InstallerInterface
private $module;

/**
* @var ImageService
* @var OrderStateImageService
*/
private $imageService;

Expand All @@ -80,7 +80,7 @@ class Installer implements InstallerInterface

public function __construct(
Mollie $module,
ImageService $imageService,
OrderStateImageService $imageService,
InstallerInterface $databaseTableInstaller
) {
$this->module = $module;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,43 @@

namespace Mollie\Service;

class ImageService
class OrderStateImageService
{
/**
* @var int
*/
public function createOrderStateLogo($orderStateId)
{
$source = _PS_MODULE_DIR_ . 'mollie/views/img/logo_small.png';
$destination = _PS_ORDER_STATE_IMG_DIR_ . $orderStateId . '.gif';
@copy($source, $destination);
}

/**
* @var int
*/
public function deleteOrderStateLogo($orderStateId)
{
$destination = _PS_ORDER_STATE_IMG_DIR_ . $orderStateId . '.gif';
@unlink($destination);
}

/**
* @var int
*/
public function createTemporaryOrderStateLogo($orderStateId)
{
$source = _PS_MODULE_DIR_ . 'mollie/views/img/logo_small.png';
$destination = _PS_TMP_IMG_DIR_ . 'order_state_mini_' . $orderStateId . '_1.gif';
@copy($source, $destination);
}

/**
* @var int
*/
public function deleteTemporaryOrderStateLogo($orderStateId)
{
$destination = _PS_TMP_IMG_DIR_ . 'order_state_mini_' . $orderStateId . '_1.gif';
@unlink($destination);
}
}
18 changes: 18 additions & 0 deletions upgrade/Upgrade-4.2.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

use Mollie\Config\Config;
use Mollie\Install\Installer;
use Mollie\Service\OrderStateImageService;

if (!defined('_PS_VERSION_')) {
exit;
Expand Down Expand Up @@ -71,5 +72,22 @@ function upgrade_module_4_2_0($module)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'
);

/**
* @var OrderStateImageService $imageService
*/
$imageService = $module->getMollieContainer(OrderStateImageService::class);
$mollieOrderStatuses = Config::getMollieOrderStatuses();

foreach ($mollieOrderStatuses as $mollieOrderStatus) {
$orderStatusId = Configuration::get($mollieOrderStatus);

if ($orderStatusId) {
$imageService->deleteOrderStateLogo($orderStatusId);
$imageService->deleteTemporaryOrderStateLogo($orderStatusId);
$imageService->createOrderStateLogo($orderStatusId);
$imageService->createTemporaryOrderStateLogo($orderStatusId);
}
}

return true;
}
6 changes: 3 additions & 3 deletions vendor/composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
*
* @author Fabien Potencier <[email protected]>
* @author Jordi Boggiano <[email protected]>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
Expand All @@ -60,7 +60,7 @@ class ClassLoader
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}

return array();
Expand Down
2 changes: 2 additions & 0 deletions vendor/composer/LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Copyright (c) Nils Adermann, Jordi Boggiano

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -17,3 +18,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

9 changes: 5 additions & 4 deletions vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'ComposerAutoloaderInit5ff99363f3a94bfd1a9a51f90cf5ccfc' => $vendorDir . '/composer/autoload_real.php',
'Composer\\Autoload\\ClassLoader' => $vendorDir . '/composer/ClassLoader.php',
'Composer\\Autoload\\ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc' => $vendorDir . '/composer/autoload_static.php',
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
'MolCarrierInformation' => $baseDir . '/src/Entity/MolCarrierInformation.php',
'MolCustomer' => $baseDir . '/src/Entity/MolCustomer.php',
'MolOrderFee' => $baseDir . '/src/Entity/MolOrderFee.php',
Expand Down Expand Up @@ -47,9 +48,9 @@
'MolliePrefix\\Constant_Check' => $vendorDir . '/prestashop/php-dev-tools/tests/modules_samples/constant_check/constant_check.php',
'MolliePrefix\\DivisionByZeroError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
'MolliePrefix\\Error' => $vendorDir . '/paragonie/random_compat/lib/error_polyfill.php',
'MolliePrefix\\Fakemodule' => $vendorDir . '/prestashop/header-stamp/tests/integration/expected/fakemodule/fakemodule.php',
'MolliePrefix\\Fakemodule' => $vendorDir . '/prestashop/header-stamp/tests/integration/module-samples/fakemodule/fakemodule.php',
'MolliePrefix\\FolderComparator' => $vendorDir . '/prestashop/header-stamp/tests/integration/runner/FolderComparator.php',
'MolliePrefix\\Gsitemap' => $vendorDir . '/prestashop/header-stamp/tests/integration/expected/gsitemap/gsitemap.php',
'MolliePrefix\\Gsitemap' => $vendorDir . '/prestashop/header-stamp/tests/integration/module-samples/gsitemap/gsitemap.php',
'MolliePrefix\\GuzzleHttp\\Client' => $vendorDir . '/guzzlehttp/guzzle/src/Client.php',
'MolliePrefix\\GuzzleHttp\\ClientInterface' => $vendorDir . '/guzzlehttp/guzzle/src/ClientInterface.php',
'MolliePrefix\\GuzzleHttp\\Cookie\\CookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php',
Expand Down Expand Up @@ -824,7 +825,7 @@
'MolliePrefix\\Symfony\\Polyfill\\Php70\\Php70' => $vendorDir . '/symfony/polyfill-php70/Php70.php',
'MolliePrefix\\Symfony\\Polyfill\\Php72\\Php72' => $vendorDir . '/symfony/polyfill-php72/Php72.php',
'MolliePrefix\\TypeError' => $vendorDir . '/paragonie/random_compat/lib/error_polyfill.php',
'MolliePrefix\\dashproducts' => $vendorDir . '/prestashop/header-stamp/tests/integration/expected/dashproducts/dashproducts.php',
'MolliePrefix\\dashproducts' => $vendorDir . '/prestashop/header-stamp/tests/integration/module-samples/dashproducts/dashproducts.php',
'MollieQrcodeModuleFrontController' => $baseDir . '/controllers/front/qrcode.php',
'MollieReturnModuleFrontController' => $baseDir . '/controllers/front/return.php',
'MollieWebhookModuleFrontController' => $baseDir . '/controllers/front/webhook.php',
Expand Down Expand Up @@ -911,7 +912,6 @@
'Mollie\\Service\\CustomerService' => $baseDir . '/src/Service/CustomerService.php',
'Mollie\\Service\\ErrorDisplayService' => $baseDir . '/src/Service/ErrorDisplayService.php',
'Mollie\\Service\\ExceptionService' => $baseDir . '/src/Service/ExceptionService.php',
'Mollie\\Service\\ImageService' => $baseDir . '/src/Service/ImageService.php',
'Mollie\\Service\\IssuerService' => $baseDir . '/src/Service/IssuerService.php',
'Mollie\\Service\\LanguageService' => $baseDir . '/src/Service/LanguageService.php',
'Mollie\\Service\\MailService' => $baseDir . '/src/Service/MailService.php',
Expand All @@ -921,6 +921,7 @@
'Mollie\\Service\\MolliePaymentMailService' => $baseDir . '/src/Service/MolliePaymentMailService.php',
'Mollie\\Service\\OrderCartAssociationService' => $baseDir . '/src/Service/OrderCartAssociationService.php',
'Mollie\\Service\\OrderFeeService' => $baseDir . '/src/Service/OrderFeeService.php',
'Mollie\\Service\\OrderStateImageService' => $baseDir . '/src/Service/OrderStateImageService.php',
'Mollie\\Service\\OrderStatusService' => $baseDir . '/src/Service/OrderStatusService.php',
'Mollie\\Service\\PaymentMethodService' => $baseDir . '/src/Service/PaymentMethodService.php',
'Mollie\\Service\\PaymentMethod\\PaymentMethodSortProvider' => $baseDir . '/src/Service/PaymentMethod/PaymentMethodSortProvider.php',
Expand Down
4 changes: 3 additions & 1 deletion vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ public static function getLoader()
return self::$loader;
}

require __DIR__ . '/platform_check.php';

spl_autoload_register(array('ComposerAutoloaderInit5ff99363f3a94bfd1a9a51f90cf5ccfc', 'loadClassLoader'), true, false);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit5ff99363f3a94bfd1a9a51f90cf5ccfc', 'loadClassLoader'));

$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
require __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc::getInitializer($loader));
} else {
Expand Down
9 changes: 5 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ class ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc
'ComposerAutoloaderInit5ff99363f3a94bfd1a9a51f90cf5ccfc' => __DIR__ . '/..' . '/composer/autoload_real.php',
'Composer\\Autoload\\ClassLoader' => __DIR__ . '/..' . '/composer/ClassLoader.php',
'Composer\\Autoload\\ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc' => __DIR__ . '/..' . '/composer/autoload_static.php',
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'MolCarrierInformation' => __DIR__ . '/../..' . '/src/Entity/MolCarrierInformation.php',
'MolCustomer' => __DIR__ . '/../..' . '/src/Entity/MolCustomer.php',
'MolOrderFee' => __DIR__ . '/../..' . '/src/Entity/MolOrderFee.php',
Expand Down Expand Up @@ -272,9 +273,9 @@ class ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc
'MolliePrefix\\Constant_Check' => __DIR__ . '/..' . '/prestashop/php-dev-tools/tests/modules_samples/constant_check/constant_check.php',
'MolliePrefix\\DivisionByZeroError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
'MolliePrefix\\Error' => __DIR__ . '/..' . '/paragonie/random_compat/lib/error_polyfill.php',
'MolliePrefix\\Fakemodule' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/expected/fakemodule/fakemodule.php',
'MolliePrefix\\Fakemodule' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/module-samples/fakemodule/fakemodule.php',
'MolliePrefix\\FolderComparator' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/runner/FolderComparator.php',
'MolliePrefix\\Gsitemap' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/expected/gsitemap/gsitemap.php',
'MolliePrefix\\Gsitemap' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/module-samples/gsitemap/gsitemap.php',
'MolliePrefix\\GuzzleHttp\\Client' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Client.php',
'MolliePrefix\\GuzzleHttp\\ClientInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/ClientInterface.php',
'MolliePrefix\\GuzzleHttp\\Cookie\\CookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php',
Expand Down Expand Up @@ -1049,7 +1050,7 @@ class ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc
'MolliePrefix\\Symfony\\Polyfill\\Php70\\Php70' => __DIR__ . '/..' . '/symfony/polyfill-php70/Php70.php',
'MolliePrefix\\Symfony\\Polyfill\\Php72\\Php72' => __DIR__ . '/..' . '/symfony/polyfill-php72/Php72.php',
'MolliePrefix\\TypeError' => __DIR__ . '/..' . '/paragonie/random_compat/lib/error_polyfill.php',
'MolliePrefix\\dashproducts' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/expected/dashproducts/dashproducts.php',
'MolliePrefix\\dashproducts' => __DIR__ . '/..' . '/prestashop/header-stamp/tests/integration/module-samples/dashproducts/dashproducts.php',
'MollieQrcodeModuleFrontController' => __DIR__ . '/../..' . '/controllers/front/qrcode.php',
'MollieReturnModuleFrontController' => __DIR__ . '/../..' . '/controllers/front/return.php',
'MollieWebhookModuleFrontController' => __DIR__ . '/../..' . '/controllers/front/webhook.php',
Expand Down Expand Up @@ -1136,7 +1137,6 @@ class ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc
'Mollie\\Service\\CustomerService' => __DIR__ . '/../..' . '/src/Service/CustomerService.php',
'Mollie\\Service\\ErrorDisplayService' => __DIR__ . '/../..' . '/src/Service/ErrorDisplayService.php',
'Mollie\\Service\\ExceptionService' => __DIR__ . '/../..' . '/src/Service/ExceptionService.php',
'Mollie\\Service\\ImageService' => __DIR__ . '/../..' . '/src/Service/ImageService.php',
'Mollie\\Service\\IssuerService' => __DIR__ . '/../..' . '/src/Service/IssuerService.php',
'Mollie\\Service\\LanguageService' => __DIR__ . '/../..' . '/src/Service/LanguageService.php',
'Mollie\\Service\\MailService' => __DIR__ . '/../..' . '/src/Service/MailService.php',
Expand All @@ -1146,6 +1146,7 @@ class ComposerStaticInit5ff99363f3a94bfd1a9a51f90cf5ccfc
'Mollie\\Service\\MolliePaymentMailService' => __DIR__ . '/../..' . '/src/Service/MolliePaymentMailService.php',
'Mollie\\Service\\OrderCartAssociationService' => __DIR__ . '/../..' . '/src/Service/OrderCartAssociationService.php',
'Mollie\\Service\\OrderFeeService' => __DIR__ . '/../..' . '/src/Service/OrderFeeService.php',
'Mollie\\Service\\OrderStateImageService' => __DIR__ . '/../..' . '/src/Service/OrderStateImageService.php',
'Mollie\\Service\\OrderStatusService' => __DIR__ . '/../..' . '/src/Service/OrderStatusService.php',
'Mollie\\Service\\PaymentMethodService' => __DIR__ . '/../..' . '/src/Service/PaymentMethodService.php',
'Mollie\\Service\\PaymentMethod\\PaymentMethodSortProvider' => __DIR__ . '/../..' . '/src/Service/PaymentMethod/PaymentMethodSortProvider.php',
Expand Down
28 changes: 16 additions & 12 deletions vendor/composer/platform_check.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
<?php

namespace MolliePrefix;

// platform_check.php @generated by Composer

$issues = array();
if (!(\PHP_VERSION_ID >= 50600)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . \PHP_VERSION . '.';

if (!(PHP_VERSION_ID >= 50600)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
}

if ($issues) {
if (!\headers_sent()) {
\header('HTTP/1.1 500 Internal Server Error');
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!\ini_get('display_errors')) {
if (\PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg') {
\fwrite(\STDERR, 'Composer detected issues in your platform:' . \PHP_EOL . \PHP_EOL . \implode(\PHP_EOL, $issues) . \PHP_EOL . \PHP_EOL);
} elseif (!\headers_sent()) {
echo 'Composer detected issues in your platform:' . \PHP_EOL . \PHP_EOL . \str_replace('You are running ' . \PHP_VERSION . '.', '', \implode(\PHP_EOL, $issues)) . \PHP_EOL . \PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
\trigger_error('Composer detected issues in your platform: ' . \implode(' ', $issues), \E_USER_ERROR);
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
);
}
Binary file modified views/img/logo_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dcda5c1

Please sign in to comment.