Skip to content

Commit

Permalink
Merge pull request #780 from PrestaShopCorp/ps9-compat-20230131
Browse files Browse the repository at this point in the history
ps_mbo on PS 9
  • Loading branch information
jinpresta authored Oct 16, 2024
2 parents e4cbef3 + b97f173 commit 59634bf
Show file tree
Hide file tree
Showing 53 changed files with 421 additions and 377 deletions.
4 changes: 3 additions & 1 deletion bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@

require_once $rootDir . '/vendor/autoload.php';

(new \Symfony\Component\Dotenv\Dotenv(true))->loadEnv(__DIR__ . '/.env');
(new \Symfony\Component\Dotenv\Dotenv())
->usePutenv()
->loadEnv(__DIR__ . '/.env');
2 changes: 1 addition & 1 deletion config/routes/addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ admin_mbo_addons_module_upgrade:
path: /modules/upgrade
methods: [ POST ]
defaults:
_controller: mbo.controller.addons:upgradeModuleAction
_controller: 'PrestaShop\Module\Mbo\Controller\Admin\AddonsController::upgradeModuleAction'
6 changes: 3 additions & 3 deletions config/routes/modules_catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ admin_mbo_catalog_module:
path: /
methods: [GET]
defaults:
_controller: mbo.controller.modules.catalog:indexAction
_controller: 'PrestaShop\Module\Mbo\Controller\Admin\ModuleCatalogController::indexAction'
_legacy_controller: AdminPsMboModule
_legacy_link:
- AdminPsMboModuleParent
Expand All @@ -12,12 +12,12 @@ admin_mbo_catalog_module_selection:
path: /selection
methods: [GET]
defaults:
_controller: mbo.controller.modules.selection:indexAction
_controller: 'PrestaShop\Module\Mbo\Controller\Admin\ModuleSelectionController::indexAction'
_legacy_controller: AdminPsMboSelection
_legacy_link: AdminPsMboSelection

admin_mbo_module_cdc_error:
path: /cdc_error
methods: [ GET ]
defaults:
_controller: mbo.controller.modules.catalog:cdcErrorAction
_controller: 'PrestaShop\Module\Mbo\Controller\Admin\ModuleCatalogController::cdcErrorAction'
2 changes: 1 addition & 1 deletion config/routes/recommended_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ admin_mbo_recommended_modules:
path: /
methods: [GET]
defaults:
_controller: mbo.controller.modules.recommended:indexAction
_controller: 'PrestaShop\Module\Mbo\Controller\Admin\ModuleRecommendedController::indexAction'
_legacy_controller: AdminPsMboRecommended
_legacy_link: AdminPsMboRecommended
2 changes: 1 addition & 1 deletion config/routes/theme_catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ admin_mbo_catalog_theme:
path: /
methods: [GET]
defaults:
_controller: mbo.controller.themes.catalog:indexAction
_controller: 'PrestaShop\Module\Mbo\Controller\Admin\ThemeCatalogController::indexAction'
_legacy_controller: AdminPsMboTheme
_legacy_link: AdminPsMboTheme
59 changes: 24 additions & 35 deletions config/services.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,32 @@ services:
_defaults:
public: true

mbo.externalcontent.provider:
class: 'PrestaShop\Module\Mbo\Service\ExternalContentProvider\ExternalContentProvider'
Symfony\Contracts\Translation\TranslatorInterface: '@PrestaShopBundle\Translation\TranslatorInterface'

mbo.addons.links_provider:
class: 'PrestaShop\Module\Mbo\Addons\Provider\LinksProvider'
arguments:
- '@prestashop.core.foundation.version'
- '@prestashop.adapter.legacy.context'
- '@prestashop.adapter.legacy.configuration'
- '@request_stack'
- '@prestashop.categories_provider'
- '@translator'
- '@router'

mbo.controller.modules.catalog:
class: 'PrestaShop\Module\Mbo\Controller\Admin\ModuleCatalogController'

mbo.controller.modules.selection:
class: 'PrestaShop\Module\Mbo\Controller\Admin\ModuleSelectionController'
arguments:
- '@request_stack'
PrestaShop\Module\Mbo\Service\ExternalContentProvider\ExternalContentProviderInterface: '@PrestaShop\Module\Mbo\Service\ExternalContentProvider\ExternalContentProvider'

mbo.controller.modules.recommended:
class: 'PrestaShop\Module\Mbo\Controller\Admin\ModuleRecommendedController'
arguments:
- '@request_stack'
calls:
- [ setContainer, [ '@service_container' ] ]
PrestaShop\Module\Mbo\Service\ExternalContentProvider\ExternalContentProvider:
autowire: true

mbo.controller.themes.catalog:
class: 'PrestaShop\Module\Mbo\Controller\Admin\ThemeCatalogController'
PrestaShop\Module\Mbo\Addons\Provider\LinksProvider:
autowire: true
arguments:
- '@request_stack'
$router: '@prestashop.router'
$categoriesProvider: '@prestashop.categories_provider'

mbo.controller.addons:
class: 'PrestaShop\Module\Mbo\Controller\Admin\AddonsController'
arguments:
- '@request_stack'
- '@prestashop.module.manager'
- '@prestashop.core.admin.module.repository'
PrestaShop\Module\Mbo\Controller\Admin\ModuleCatalogController:
autowire: true
autoconfigure: true

PrestaShop\Module\Mbo\Controller\Admin\ModuleSelectionController:
autowire: true

PrestaShop\Module\Mbo\Controller\Admin\ModuleRecommendedController:
autowire: true
autoconfigure: true

PrestaShop\Module\Mbo\Controller\Admin\ThemeCatalogController:
autowire: true

PrestaShop\Module\Mbo\Controller\Admin\AddonsController:
autowire: true
21 changes: 9 additions & 12 deletions config/services/accounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@ services:
_defaults:
public: true

mbo.ps_accounts.installer:
class: 'PrestaShop\PsAccountsInstaller\Installer\Installer'
public: true
PrestaShop\PsAccountsInstaller\Installer\Installer:
autowire: true
arguments:
- "5.2.5"
$psAccountsVersion: "5.2.5"

mbo.ps_accounts.facade:
class: 'PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts'
public: true
arguments:
- "@mbo.ps_accounts.installer"
PrestaShop\PsAccountsInstaller\Installer\Facade\PsAccounts:
autowire: true

mbo.accounts.data_provider:
class: PrestaShop\Module\Mbo\Accounts\Provider\AccountsDataProvider
PrestaShop\Module\Mbo\Accounts\Provider\AccountsDataProvider:
autowire: true
autoconfigure: true
arguments:
- "5.2.5"
$psAccountsVersion: "5.2.5"
17 changes: 4 additions & 13 deletions config/services/addons.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,9 @@

//Only load event subscriber when module is enabled to avoid logging events if disabled
if (ps_mbo::checkModuleStatus()) {
$services->set('mbo.addons.event_subscriber', ModuleManagementEventSubscriber::class)
->args([
ref('logger'),
ref('mbo.modules.repository'),
ref('mbo.tab.collection.provider'),
ref('mbo.cdc.context_builder'),
ref('mbo.cdc.client.distribution_api'),
ref('mbo.security.admin_authentication.provider'),
ref('mbo.distribution.api_version_change_config_apply_handler'),
ref('mbo.symfony_cache_clearer'),
])
->public()
->tag('kernel.event_subscriber');
$services->set(ModuleManagementEventSubscriber::class)
->autowire()
->public()
->tag('kernel.event_subscriber');
}
};
37 changes: 13 additions & 24 deletions config/services/addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,24 @@ services:
_defaults:
public: true

mbo.addons.user:
class: PrestaShop\Module\Mbo\Addons\User\AddonsUser
arguments:
- '@session'
- '@mbo.accounts.data_provider'
PrestaShop\Module\Mbo\Addons\User\AddonsUser:
autowire: true
autoconfigure: true

mbo.addons.user.provider:
class: PrestaShop\Module\Mbo\Addons\User\AddonsUserProvider
arguments:
- "@mbo.addons.user"
PrestaShop\Module\Mbo\Addons\User\AddonsUserProvider:
autowire: true
autoconfigure: true

mbo.addons.data_provider:
class: PrestaShop\Module\Mbo\Addons\Provider\AddonsDataProvider
arguments:
- '@mbo.addons.client.api'
- '@=service("mbo.addons.user.provider").getUser()'
- '@=service("prestashop.adapter.legacy.configuration").get("ADDONS_API_MODULE_CHANNEL", "stable")'
PrestaShop\Module\Mbo\Addons\Provider\AddonsDataProvider:
autowire: true
properties:
cacheDir: "%kernel.cache_dir%"

# Addons API Client
mbo.addons.client.api:
class: PrestaShop\Module\Mbo\Addons\ApiClient
PrestaShop\Module\Mbo\Addons\ApiClient:
autowire: true
arguments:
- "@mbo.addons.client.http"
$httpClient: '@mbo.addons.client.http'
calls:
- method: setDefaultParams
arguments:
Expand All @@ -35,9 +28,5 @@ services:
- "@=service('prestashop.adapter.legacy.configuration').get('_PS_BASE_URL_')"
- "@=service('prestashop.core.foundation.version').getSemVersion()"

mbo.addons.toolbar:
class: PrestaShop\Module\Mbo\Addons\Toolbar
arguments:
- '@mbo.security.permission_checker'
- '@mbo.addons.data_provider'
- '@translator'
PrestaShop\Module\Mbo\Addons\Toolbar:
autowire: true
23 changes: 9 additions & 14 deletions config/services/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,18 @@ services:
- 'ps_mbo'

PrestaShop\Module\Mbo\Api\Config\Env:
class: PrestaShop\Module\Mbo\Api\Config\Env
autowire: true

mbo.api.service.executors.module_transition:
class: PrestaShop\Module\Mbo\Api\Service\ModuleTransitionExecutor
arguments:
- '@mbo.modules.module_status_transition_handler'
PrestaShop\Module\Mbo\Api\Service\ModuleTransitionExecutor:
autowire: true

mbo.api.service.executors.config_apply:
class: PrestaShop\Module\Mbo\Api\Service\ConfigApplyExecutor
arguments:
- '@mbo.distribution.api_config_change_handler'
- '@ps_mbo'
PrestaShop\Module\Mbo\Api\Service\ConfigApplyExecutor:
autowire: true

mbo.api.service.factory:
class: PrestaShop\Module\Mbo\Api\Service\Factory
PrestaShop\Module\Mbo\Api\Service\Factory:
autowire: true
arguments:
- [
'@mbo.api.service.executors.module_transition',
'@mbo.api.service.executors.config_apply'
'@PrestaShop\Module\Mbo\Api\Service\ModuleTransitionExecutor',
'@PrestaShop\Module\Mbo\Api\Service\ConfigApplyExecutor'
]
40 changes: 16 additions & 24 deletions config/services/api/distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,29 @@ services:
_defaults:
public: true

mbo.distribution.config_factory:
class: 'PrestaShop\Module\Mbo\Distribution\Config\Factory'
PrestaShop\Module\Mbo\Distribution\Config\Factory:
autowire: true

mbo.distribution.config_applier:
class: 'PrestaShop\Module\Mbo\Distribution\Config\Applier'
arguments:
- '@mbo.distribution.config_appliers_factory'
PrestaShop\Module\Mbo\Distribution\Config\Applier:
autowire: true

mbo.distribution.theme_catalog_menu_config_applier:
class: PrestaShop\Module\Mbo\Distribution\Config\Appliers\ThemeCatalogMenuConfigApplier
PrestaShop\Module\Mbo\Distribution\Config\Appliers\ThemeCatalogMenuConfigApplier:
autowire: true

mbo.distribution.module_selection_menu_config_applier:
class: PrestaShop\Module\Mbo\Distribution\Config\Appliers\ModuleSelectionMenuConfigApplier
PrestaShop\Module\Mbo\Distribution\Config\Appliers\ModuleSelectionMenuConfigApplier:
autowire: true

mbo.distribution.config_appliers_factory:
class: 'PrestaShop\Module\Mbo\Distribution\Config\Appliers\Factory'
PrestaShop\Module\Mbo\Distribution\Config\Appliers\Factory:
autowire: true
arguments:
- [
'@mbo.distribution.theme_catalog_menu_config_applier',
'@mbo.distribution.module_selection_menu_config_applier'
'@PrestaShop\Module\Mbo\Distribution\Config\Appliers\ThemeCatalogMenuConfigApplier',
'@PrestaShop\Module\Mbo\Distribution\Config\Appliers\ModuleSelectionMenuConfigApplier'
]

mbo.distribution.api_config_change_handler:
class: 'PrestaShop\Module\Mbo\Distribution\Config\CommandHandler\ConfigChangeCommandHandler'
arguments:
- '@mbo.distribution.config_factory'
- '@mbo.distribution.config_applier'
PrestaShop\Module\Mbo\Distribution\Config\CommandHandler\ConfigChangeCommandHandler:
autowire: true


mbo.distribution.api_version_change_config_apply_handler:
class: 'PrestaShop\Module\Mbo\Distribution\Config\CommandHandler\VersionChangeApplyConfigCommandHandler'
arguments:
- '@mbo.distribution.config_factory'
- '@mbo.distribution.config_applier'
PrestaShop\Module\Mbo\Distribution\Config\CommandHandler\VersionChangeApplyConfigCommandHandler:
autowire: true
34 changes: 10 additions & 24 deletions config/services/api/modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,21 @@ services:
_defaults:
public: true

mbo.modules.source_retriever.url:
class: 'PrestaShop\Module\Mbo\Module\SourceRetriever\AddonsUrlSourceRetriever'
PrestaShop\Module\Mbo\Module\SourceRetriever\AddonsUrlSourceRetriever:
autowire: true
arguments:
$addonsDataProvider: '@mbo.addons.data_provider'
$translator: '@translator'
$modulePath: '%modules_dir%'
properties:
cacheDir: "%kernel.cache_dir%"

mbo.modules.transitions_manager:
class: 'PrestaShop\Module\Mbo\Module\Workflow\TransitionsManager'
arguments:
- '@prestashop.module.manager'
- '@mbo.hook_exception_holder'
PrestaShop\Module\Mbo\Module\Workflow\TransitionsManager:
autowire: true

mbo.modules.transition_builder:
class: PrestaShop\Module\Mbo\Module\Workflow\TransitionBuilder
PrestaShop\Module\Mbo\Module\Workflow\TransitionBuilder:
autowire: true

mbo.modules.transition_applier:
class: PrestaShop\Module\Mbo\Module\Workflow\TransitionApplier
arguments:
- '@mbo.modules.transitions_manager'
- '@translator'
PrestaShop\Module\Mbo\Module\Workflow\TransitionApplier:
autowire: true

mbo.modules.module_status_transition_handler:
class: 'PrestaShop\Module\Mbo\Module\CommandHandler\ModuleStatusTransitionCommandHandler'
arguments:
- '@mbo.modules.repository'
- '@mbo.modules.actions_manager'
- '@mbo.modules.builder'
- '@mbo.modules.transition_builder'
- '@mbo.modules.transition_applier'
PrestaShop\Module\Mbo\Module\CommandHandler\ModuleStatusTransitionCommandHandler:
autowire: true
2 changes: 1 addition & 1 deletion config/services/api/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ services:
public: true

PrestaShop\Module\Mbo\Api\Repository\ModuleRepository:
class: PrestaShop\Module\Mbo\Api\Repository\ModuleRepository
autowire: true
15 changes: 7 additions & 8 deletions config/services/cdc.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ services:
_defaults:
public: true

mbo.cdc.context_builder:
class: PrestaShop\Module\Mbo\Service\View\ContextBuilder
PrestaShop\Module\Mbo\Service\View\ContextBuilder:
autowire: true
arguments:
- '@prestashop.adapter.legacy.context'
- '@prestashop.core.admin.module.repository'
- '@router'
- '@doctrine.cache.provider'
- '@mbo.security.admin_authentication.provider'
- '@mbo.accounts.data_provider'
$router: '@prestashop.router'
$cacheProvider: '@Doctrine\Common\Cache\Psr6\DoctrineProvider'

mbo.cdc.context_builder:
alias: PrestaShop\Module\Mbo\Service\View\ContextBuilder
Loading

0 comments on commit 59634bf

Please sign in to comment.