From 22b84c931153ddb1645737e4d8658df8302ade6b Mon Sep 17 00:00:00 2001 From: Sync Common Files Bot Date: Thu, 16 Jan 2025 12:18:02 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20synced=20file(s)=20with=20pimcor?= =?UTF-8?q?e/sync-common-files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ci/files/bin/console | 37 +++++++++++++------------- .github/ci/files/public/index_test.php | 29 ++++++++++---------- 2 files changed, 32 insertions(+), 34 deletions(-) diff --git a/.github/ci/files/bin/console b/.github/ci/files/bin/console index 3afd8d56..b37ac8fb 100644 --- a/.github/ci/files/bin/console +++ b/.github/ci/files/bin/console @@ -13,35 +13,34 @@ * @license http://www.pimcore.org/license GPLv3 and PEL */ -use Symfony\Component\Console\Input\InputInterface; - ob_get_clean(); -if (file_exists($a = getcwd() . '/vendor/autoload_runtime.php')) { +if (file_exists($a = getcwd() . '/vendor/autoload.php')) { include $a; -} elseif (file_exists($a = __DIR__ . '/../../../../vendor/autoload_runtime.php')) { +} elseif (file_exists($a = __DIR__ . '/../../../../vendor/autoload.php')) { include $a; -} elseif (file_exists($a = __DIR__ . '/../vendor/autoload_runtime.php')) { +} elseif (file_exists($a = __DIR__ . '/../vendor/autoload.php')) { include $a; } else { fwrite(STDERR, 'Cannot locate autoloader; please run "composer install"' . PHP_EOL); exit(1); } -return function (InputInterface $input) { - define('PIMCORE_CONSOLE', true); +\Pimcore\Bootstrap::setProjectRoot(); + +define('PIMCORE_CONSOLE', true); - if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); - } - if ($input->hasParameterOption('--no-debug', true)) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); - } +$input = new \Symfony\Component\Console\Input\ArgvInput(); +if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) { + putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); +} + +if ($input->hasParameterOption('--no-debug', true)) { + putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); +} - /** @var \Pimcore\Kernel $kernel */ - $kernel = \Pimcore\Bootstrap::startupCli(); - $application = new \Pimcore\Console\Application($kernel); - $application->run(); - return $application; -}; +/** @var \Pimcore\Kernel $kernel */ +$kernel = \Pimcore\Bootstrap::startupCli(); +$application = new \Pimcore\Console\Application($kernel); +$application->run(); diff --git a/.github/ci/files/public/index_test.php b/.github/ci/files/public/index_test.php index 4a4adba6..c4daad55 100644 --- a/.github/ci/files/public/index_test.php +++ b/.github/ci/files/public/index_test.php @@ -15,28 +15,27 @@ use Pimcore\Tool; use Symfony\Component\HttpFoundation\Request; -include __DIR__ . "/../vendor/autoload_runtime.php"; +include __DIR__ . "/../vendor/autoload.php"; -return function (array $context) { - define('PIMCORE_PROJECT_ROOT', __DIR__ . '/..'); - define('APP_ENV', 'test'); +define('PIMCORE_PROJECT_ROOT', __DIR__ . '/..'); +define('APP_ENV', 'test'); - $request = Request::createFromGlobals(); +\Pimcore\Bootstrap::setProjectRoot(); +\Pimcore\Bootstrap::bootstrap(); + +$request = Request::createFromGlobals(); // set current request as property on tool as there's no // request stack available yet - Tool::setCurrentRequest($request); +Tool::setCurrentRequest($request); - \Pimcore\Bootstrap::bootstrap(); - /** @var \Pimcore\Kernel $kernel */ - $kernel = \Pimcore\Bootstrap::kernel(); +/** @var \Pimcore\Kernel $kernel */ +$kernel = \Pimcore\Bootstrap::kernel(); // reset current request - will be read from request stack from now on - Tool::setCurrentRequest(null); +Tool::setCurrentRequest(null); - $response = $kernel->handle($request); - $response->send(); +$response = $kernel->handle($request); +$response->send(); - $kernel->terminate($request, $response); - return $kernel; -}; +$kernel->terminate($request, $response);