Skip to content

Commit

Permalink
✨ Be sure URL of MBO is the correct one on the dependencies array
Browse files Browse the repository at this point in the history
  • Loading branch information
intraordinaire committed Jul 5, 2024
1 parent d9bfc0b commit 44d6f75
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/DependencyBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

class DependencyBuilder
{
const DEPENDENCY_FILENAME = 'module_dependencies.json';
const GET_PARAMETER = 'mbo_action_needed';
const DEFAULT_LOCALE = 'en-GB';
const DEFAULT_HELP_URLS = [
public const DEPENDENCY_FILENAME = 'module_dependencies.json';
public const GET_PARAMETER = 'mbo_action_needed';
public const DEFAULT_LOCALE = 'en-GB';
public const DEFAULT_HELP_URLS = [
'en_GB' => 'https://addons.prestashop.com/en/contact-us',
'en_US' => 'https://addons.prestashop.com/en/contact-us',
'de_DE' => 'https://addons.prestashop.com/de/contact-us',
Expand Down Expand Up @@ -204,10 +204,16 @@ protected function buildRoutesForModule($moduleName)
{
$urls = [];
foreach (['install', 'enable', 'upgrade'] as $action) {
$route = $this->router->generate('admin_module_manage_action', [
'action' => $action,
'module_name' => $moduleName,
]);
if ($action === 'install' && $moduleName === 'ps_mbo' && !empty($_SERVER['REQUEST_URI'])) {
$query = http_build_query(array_merge($_GET, [self::GET_PARAMETER => '1']));
$baseUri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$route = $baseUri . '?' . $query;
} else {
$route = $this->router->generate('admin_module_manage_action', [
'action' => $action,
'module_name' => $moduleName,
]);
}

if (is_string($route)) {
$urls[$action] = $route;
Expand Down

0 comments on commit 44d6f75

Please sign in to comment.