#!/usr/bin/env php usePutenv(false) ->loadEnv($dotEnvFile) ; try { require_once __DIR__ . '/../config/config.inc.php'; } catch (PrestaShopException $e) { // Prevent breaking all CLI command when the shop is not installed, define fallback values if (!defined('__PS_BASE_URI__')) { define('__PS_BASE_URI__', '/'); } if (!defined('_THEME_NAME_')) { define('_THEME_NAME_', Theme::getDefaultTheme()); } if (!defined('_PARENT_THEME_NAME_')) { define('_PARENT_THEME_NAME_', ''); } // Define all the URI base constants require_once __DIR__ . '/../config/defines_uri.inc.php'; } $input = new ArgvInput(); $env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); $debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; // Handle PrestaShop global option app-id, by default use the Admin kernel $appId = $input->getParameterOption(['--app-id'], getenv('APP_ID') ?: 'admin'); $kernelClass = match ($appId) { AdminKernel::APP_ID => AdminKernel::class, FrontKernel::APP_ID => FrontKernel::class, AdminAPIKernel::APP_ID => AdminAPIKernel::class, default => throw new InvalidArgumentException('Unknown PrestaShop kernel matching the ID ' . $appId), }; if ($debug) { Debug::enable(); } $kernel = new $kernelClass($env, $debug); $application = new PrestaShopApplication($kernel); $application->run($input);