#!/usr/bin/env php . */ if (php_sapi_name() !== 'cli') { echo 'Unauthorized'; exit(1); } $pathToAutoload = realpath(__DIR__ . '/../src/vendor/autoload.php'); $errorMessage = " Cannot find composer dependencies. Run below command and try again;\n $ cd %s $ composer install -d src "; if (!$pathToAutoload) { echo sprintf($errorMessage, realpath(__DIR__ . '/../')); exit(1); } use OrangeHRM\Config\Config; use OrangeHRM\Core\Command\CacheClearCommand; use OrangeHRM\Core\Command\GenerateDoctrineProxiesCommand; use OrangeHRM\Framework\Console\Console; use OrangeHRM\Framework\Console\ConsoleConfigurationInterface; use OrangeHRM\Framework\Framework; use OrangeHRM\Framework\Http\Request; use OrangeHRM\Framework\PluginConfigurationInterface; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Style\SymfonyStyle; set_time_limit(0); require_once $pathToAutoload; $env = 'prod'; $debug = 'prod' !== $env; $console = new Console(); new Framework($env, $debug); // initializing kernel $request = new Request(); $pluginConfigs = Config::get('ohrm_plugin_configs'); $input = new ArgvInput(); $output = new ConsoleOutput(); $io = new SymfonyStyle($input, $output); try { foreach (array_values($pluginConfigs) as $pluginConfig) { require_once $pluginConfig['filepath']; /** @var PluginConfigurationInterface $configClass */ $configClass = new $pluginConfig['classname'](); $configClass->initialize($request); if ($configClass instanceof ConsoleConfigurationInterface) { $configClass->registerCommands($console); } } } catch (Throwable $e) { $io->warning($e->getMessage()); } $console->add(new CacheClearCommand()); $console->add(new GenerateDoctrineProxiesCommand()); $console->run($input, $output);