mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 16:22:20 +02:00
* symfony 5.4 (diff dev) * symfony 5.4 (working) * symfony 5.4 (update autoload) * symfony 5.4 (remove swiftmailer mailer implementation) * symfony 5.4 (php doc and split Global accessor class) ### Impacted packages: composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
60 lines
1.8 KiB
PHP
60 lines
1.8 KiB
PHP
#!/usr/bin/env php
|
|
<?php
|
|
|
|
use Combodo\iTop\Portal\Kernel;
|
|
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
|
use Symfony\Component\Console\Input\ArgvInput;
|
|
|
|
if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true))
|
|
{
|
|
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
|
|
}
|
|
|
|
set_time_limit(0);
|
|
|
|
if (!defined('APPROOT'))
|
|
{
|
|
if (file_exists(__DIR__.'/../../../../approot.inc.php')) {
|
|
require_once __DIR__ . '/../../../../approot.inc.php'; // When in env-xxxx folder
|
|
} else {
|
|
require_once __DIR__ . '/../../../../../approot.inc.php'; // When in datamodels/x.x folder
|
|
}
|
|
}
|
|
require_once APPROOT . 'lib/autoload.php';
|
|
|
|
require_once APPROOT . 'application/startup.inc.php';
|
|
|
|
if (!class_exists(Application::class)) {
|
|
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
|
|
}
|
|
|
|
// Remove --portal_id from CLI params to avoid SF CLI conflicts
|
|
// Note: The parameter is needed when calling the bin/console to determine which portal to select
|
|
$aCleanedArgv = $_SERVER['argv'];
|
|
foreach ($aCleanedArgv as $iArg => $sArg)
|
|
{
|
|
if (preg_match('/^--portal_id=(.*)$/', $sArg, $aMatches))
|
|
{
|
|
unset($aCleanedArgv[$iArg]);
|
|
break;
|
|
}
|
|
}
|
|
|
|
$oInput = new ArgvInput($aCleanedArgv);
|
|
if (null !== $sEnv = $oInput->getParameterOption(['--env', '-e'], null, true))
|
|
{
|
|
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $sEnv);
|
|
}
|
|
|
|
if ($oInput->hasParameterOption('--no-debug', true))
|
|
{
|
|
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
|
|
}
|
|
|
|
require_once MODULESROOT.'itop-portal-base/portal/config/bootstrap.php';
|
|
|
|
$oKernel = new Kernel($_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
|
|
$oApplication = new Application($oKernel);
|
|
/** @noinspection PhpUnhandledExceptionInspection */
|
|
$oApplication->run($oInput);
|