#!/usr/bin/env php add(new \Elgg\Cli\InstallCommand()); $cli->run(); return; } $app = \Elgg\Application::getInstance(); $services = $app->internal_services; $cli = $services->cli; $cli->setLogger($services->logger); $argv = (array) $services->request->server->get('argv'); if (in_array('upgrade', $argv)) { // To run an upgrade successfully, we must first migrate // the application before booting it $cli->add(\Elgg\Cli\UpgradeCommand::class); $cli->run(false); return; } // For other commands, we just boot an application try { $app->start(); $cli->run(); } catch (\Throwable $throw) { fwrite(STDERR, "An error occurred during the execution of the command '" . implode(' ', $argv) . "': {$throw->getMessage()}" . PHP_EOL); die(3); }