Skip to content

Commit

Permalink
🔄 synced file(s) with pimcore/sync-common-files
Browse files Browse the repository at this point in the history
  • Loading branch information
brusch committed Jan 16, 2025
1 parent 2c120fd commit 22b84c9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 34 deletions.
37 changes: 18 additions & 19 deletions .github/ci/files/bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -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();
29 changes: 14 additions & 15 deletions .github/ci/files/public/index_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 22b84c9

Please sign in to comment.