84400, ], new CliSessionHandler()); $instance = parent::getInstance($name); JFactory::$application = $instance; return $instance; } public function __construct(Cli $input = null, \Joomla\Registry\Registry $config = null, \JEventDispatcher $dispatcher = null) { // Some servers only provide a CGI executable. While not ideal for running CLI applications we can make do. $this->detectAndWorkAroundCGIMode(); // Initialize custom options handling which is a bit more straightforward than Input\Cli. $this->initialiseCustomOptions(); parent::__construct($input, $config, $dispatcher); /** * Allow the application to close. * * This is required to allow CliApplication to execute under CGI mode. The checks performed in the parent * constructor will call close() if the application does not run pure CLI mode. However, some hosts only provide * the PHP CGI binary for executing CLI scripts. While wrong it will work in most cases. By default close() will * do nothing, thereby allowing the parent constructor to call it without a problem. Finally, we set this flag * to true to allow doExecute() to call close() and actually close the application properly. Yeehaw! */ $this->allowedToClose = true; } /** * Method to close the application. * * See the constructor for details on why it works the way it works. * * @param integer $code The exit code (optional; default is 0). * * @return void * * @codeCoverageIgnore * @since 1.0 */ public function close($code = 0) { // See the constructor for details if (!$this->allowedToClose) { return; } exit($code); } /** * Gets the name of the current running application. * * @return string The name of the application. * * @since 4.0.0 */ public function getName() { return get_class($this); } /** * Get the menu object. * * @param string $name The application name for the menu * @param array $options An array of options to initialise the menu with * * @return \Joomla\CMS\Menu\AbstractMenu|null A AbstractMenu object or null if not set. * * @since 4.0.0 */ public function getMenu($name = null, $options = []) { return null; } }