diff --git a/plugins/behaviour/compat/classes/Application/BaseApplication.php b/plugins/behaviour/compat/classes/Application/BaseApplication.php
new file mode 100644
index 0000000000000..eccdc67cbd2fb
--- /dev/null
+++ b/plugins/behaviour/compat/classes/Application/BaseApplication.php
@@ -0,0 +1,55 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Application;
+
+use Joomla\Application\AbstractApplication;
+use Joomla\Input\Input;
+use Joomla\Registry\Registry;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Joomla Platform Base Application Class
+ *
+ * @property-read Input $input The application input object
+ *
+ * @since 3.0.0
+ *
+ * @deprecated 4.3 will be removed in 6.0
+ * Application classes should directly be based on \Joomla\Application\AbstractApplication
+ * don't use this class anymore
+ */
+abstract class BaseApplication extends AbstractApplication
+{
+ use EventAware;
+ use IdentityAware;
+
+ /**
+ * Class constructor.
+ *
+ * @param ?Input $input An optional argument to provide dependency injection for the application's
+ * input object. If the argument is a Input object that object will become
+ * the application's input object, otherwise a default input object is created.
+ * @param ?Registry $config An optional argument to provide dependency injection for the application's
+ * config object. If the argument is a Registry object that object will become
+ * the application's config object, otherwise a default config object is created.
+ *
+ * @since 3.0.0
+ */
+ public function __construct(?Input $input = null, ?Registry $config = null)
+ {
+ $this->input = $input instanceof Input ? $input : new Input();
+ $this->config = $config instanceof Registry ? $config : new Registry();
+
+ $this->initialise();
+ }
+}
diff --git a/plugins/behaviour/compat/classes/Application/CLI/CliInput.php b/plugins/behaviour/compat/classes/Application/CLI/CliInput.php
new file mode 100644
index 0000000000000..c704982ae3b8d
--- /dev/null
+++ b/plugins/behaviour/compat/classes/Application/CLI/CliInput.php
@@ -0,0 +1,38 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Application\CLI;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Class CliInput
+ *
+ * @since 4.0.0
+ *
+ * @deprecated 4.3 will be removed in 6.0
+ * Use the `joomla/console` package instead
+ */
+class CliInput
+{
+ /**
+ * Get a value from standard input.
+ *
+ * @return string The input string from standard input.
+ *
+ * @codeCoverageIgnore
+ * @since 4.0.0
+ */
+ public function in()
+ {
+ return rtrim(fread(STDIN, 8192), "\n\r");
+ }
+}
diff --git a/plugins/behaviour/compat/classes/Application/CLI/CliOutput.php b/plugins/behaviour/compat/classes/Application/CLI/CliOutput.php
new file mode 100644
index 0000000000000..f0126c0e0b838
--- /dev/null
+++ b/plugins/behaviour/compat/classes/Application/CLI/CliOutput.php
@@ -0,0 +1,93 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Application\CLI;
+
+use Joomla\CMS\Application\CLI\Output\Processor\ProcessorInterface;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Base class defining a command line output handler
+ *
+ * @since 4.0.0
+ *
+ * @deprecated 4.3 will be removed in 6.0
+ * Use the `joomla/console` package instead
+ */
+abstract class CliOutput
+{
+ /**
+ * Output processing object
+ *
+ * @var ProcessorInterface
+ * @since 4.0.0
+ */
+ protected $processor;
+
+ /**
+ * Constructor
+ *
+ * @param ?ProcessorInterface $processor The output processor.
+ *
+ * @since 4.0.0
+ */
+ public function __construct(?ProcessorInterface $processor = null)
+ {
+ $this->setProcessor($processor ?: new Output\Processor\ColorProcessor());
+ }
+
+ /**
+ * Set a processor
+ *
+ * @param ProcessorInterface $processor The output processor.
+ *
+ * @return $this
+ *
+ * @since 4.0.0
+ */
+ public function setProcessor(ProcessorInterface $processor)
+ {
+ $this->processor = $processor;
+
+ return $this;
+ }
+
+ /**
+ * Get a processor
+ *
+ * @return ProcessorInterface
+ *
+ * @since 4.0.0
+ * @throws \RuntimeException
+ */
+ public function getProcessor()
+ {
+ if ($this->processor) {
+ return $this->processor;
+ }
+
+ throw new \RuntimeException('A ProcessorInterface object has not been set.');
+ }
+
+ /**
+ * Write a string to an output handler.
+ *
+ * @param string $text The text to display.
+ * @param boolean $nl True (default) to append a new line at the end of the output string.
+ *
+ * @return $this
+ *
+ * @since 4.0.0
+ * @codeCoverageIgnore
+ */
+ abstract public function out($text = '', $nl = true);
+}
diff --git a/plugins/behaviour/compat/classes/Application/CLI/ColorStyle.php b/plugins/behaviour/compat/classes/Application/CLI/ColorStyle.php
new file mode 100644
index 0000000000000..9bf56abb5cf07
--- /dev/null
+++ b/plugins/behaviour/compat/classes/Application/CLI/ColorStyle.php
@@ -0,0 +1,263 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Application\CLI;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Class defining ANSI-color styles for command line output
+ *
+ * @since 4.0.0
+ *
+ * @deprecated 4.3 will be removed in 6.0
+ * Use the `joomla/console` package instead
+ */
+final class ColorStyle
+{
+ /**
+ * Known colors
+ *
+ * @var array
+ * @since 4.0.0
+ */
+ private static $knownColors = [
+ 'black' => 0,
+ 'red' => 1,
+ 'green' => 2,
+ 'yellow' => 3,
+ 'blue' => 4,
+ 'magenta' => 5,
+ 'cyan' => 6,
+ 'white' => 7,
+ ];
+
+ /**
+ * Known styles
+ *
+ * @var array
+ * @since 4.0.0
+ */
+ private static $knownOptions = [
+ 'bold' => 1,
+ 'underscore' => 4,
+ 'blink' => 5,
+ 'reverse' => 7,
+ ];
+
+ /**
+ * Foreground base value
+ *
+ * @var integer
+ * @since 4.0.0
+ */
+ private static $fgBase = 30;
+
+ /**
+ * Background base value
+ *
+ * @var integer
+ * @since 4.0.0
+ */
+ private static $bgBase = 40;
+
+ /**
+ * Foreground color
+ *
+ * @var integer
+ * @since 4.0.0
+ */
+ private $fgColor = 0;
+
+ /**
+ * Background color
+ *
+ * @var integer
+ * @since 4.0.0
+ */
+ private $bgColor = 0;
+
+ /**
+ * Array of style options
+ *
+ * @var array
+ * @since 4.0.0
+ */
+ private $options = [];
+
+ /**
+ * Constructor
+ *
+ * @param string $fg Foreground color.
+ * @param string $bg Background color.
+ * @param array $options Style options.
+ *
+ * @since 4.0.0
+ * @throws \InvalidArgumentException
+ */
+ public function __construct(string $fg = '', string $bg = '', array $options = [])
+ {
+ if ($fg) {
+ if (\array_key_exists($fg, static::$knownColors) == false) {
+ throw new \InvalidArgumentException(
+ \sprintf(
+ 'Invalid foreground color "%1$s" [%2$s]',
+ $fg,
+ implode(', ', $this->getKnownColors())
+ )
+ );
+ }
+
+ $this->fgColor = static::$fgBase + static::$knownColors[$fg];
+ }
+
+ if ($bg) {
+ if (\array_key_exists($bg, static::$knownColors) == false) {
+ throw new \InvalidArgumentException(
+ \sprintf(
+ 'Invalid background color "%1$s" [%2$s]',
+ $bg,
+ implode(', ', $this->getKnownColors())
+ )
+ );
+ }
+
+ $this->bgColor = static::$bgBase + static::$knownColors[$bg];
+ }
+
+ foreach ($options as $option) {
+ if (\array_key_exists($option, static::$knownOptions) == false) {
+ throw new \InvalidArgumentException(
+ \sprintf(
+ 'Invalid option "%1$s" [%2$s]',
+ $option,
+ implode(', ', $this->getKnownOptions())
+ )
+ );
+ }
+
+ $this->options[] = $option;
+ }
+ }
+
+ /**
+ * Convert to a string.
+ *
+ * @return string
+ *
+ * @since 4.0.0
+ */
+ public function __toString()
+ {
+ return $this->getStyle();
+ }
+
+ /**
+ * Create a color style from a parameter string.
+ *
+ * Example: fg=red;bg=blue;options=bold,blink
+ *
+ * @param string $string The parameter string.
+ *
+ * @return $this
+ *
+ * @since 4.0.0
+ * @throws \RuntimeException
+ */
+ public static function fromString(string $string): self
+ {
+ $fg = '';
+ $bg = '';
+ $options = [];
+
+ $parts = explode(';', $string);
+
+ foreach ($parts as $part) {
+ $subParts = explode('=', $part);
+
+ if (\count($subParts) < 2) {
+ continue;
+ }
+
+ switch ($subParts[0]) {
+ case 'fg':
+ $fg = $subParts[1];
+
+ break;
+
+ case 'bg':
+ $bg = $subParts[1];
+
+ break;
+
+ case 'options':
+ $options = explode(',', $subParts[1]);
+
+ break;
+
+ default:
+ throw new \RuntimeException('Invalid option: ' . $subParts[0]);
+ }
+ }
+
+ return new self($fg, $bg, $options);
+ }
+
+ /**
+ * Get the translated color code.
+ *
+ * @return string
+ *
+ * @since 4.0.0
+ */
+ public function getStyle(): string
+ {
+ $values = [];
+
+ if ($this->fgColor) {
+ $values[] = $this->fgColor;
+ }
+
+ if ($this->bgColor) {
+ $values[] = $this->bgColor;
+ }
+
+ foreach ($this->options as $option) {
+ $values[] = static::$knownOptions[$option];
+ }
+
+ return implode(';', $values);
+ }
+
+ /**
+ * Get the known colors.
+ *
+ * @return string[]
+ *
+ * @since 4.0.0
+ */
+ public function getKnownColors(): array
+ {
+ return array_keys(static::$knownColors);
+ }
+
+ /**
+ * Get the known options.
+ *
+ * @return string[]
+ *
+ * @since 4.0.0
+ */
+ public function getKnownOptions(): array
+ {
+ return array_keys(static::$knownOptions);
+ }
+}
diff --git a/plugins/behaviour/compat/classes/Application/CLI/Output/Processor/ColorProcessor.php b/plugins/behaviour/compat/classes/Application/CLI/Output/Processor/ColorProcessor.php
new file mode 100644
index 0000000000000..559038925af4b
--- /dev/null
+++ b/plugins/behaviour/compat/classes/Application/CLI/Output/Processor/ColorProcessor.php
@@ -0,0 +1,194 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Application\CLI\Output\Processor;
+
+use Joomla\CMS\Application\CLI\ColorStyle;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Command line output processor supporting ANSI-colored output
+ *
+ * @since 4.0.0
+ *
+ * @deprecated 4.3 will be removed in 6.0
+ * Use the `joomla/console` package instead
+ */
+class ColorProcessor implements ProcessorInterface
+{
+ /**
+ * Flag to remove color codes from the output
+ *
+ * @var boolean
+ * @since 4.0.0
+ */
+ public $noColors = false;
+
+ /**
+ * Regex to match tags
+ *
+ * @var string
+ * @since 4.0.0
+ */
+ protected $tagFilter = '/<([a-z=;]+)>(.*?)<\/\\1>/s';
+
+ /**
+ * Regex used for removing color codes
+ *
+ * @var string
+ * @since 4.0.0
+ */
+ protected static $stripFilter = '/<[\/]?[a-z=;]+>/';
+
+ /**
+ * Array of ColorStyle objects
+ *
+ * @var ColorStyle[]
+ * @since 4.0.0
+ */
+ protected $styles = [];
+
+ /**
+ * Class constructor
+ *
+ * @param boolean $noColors Defines non-colored mode on construct
+ *
+ * @since 4.0.0
+ */
+ public function __construct($noColors = null)
+ {
+ if ($noColors === null) {
+ /*
+ * By default windows cmd.exe and PowerShell does not support ANSI-colored output
+ * if the variable is not set explicitly colors should be disabled on Windows
+ */
+ $noColors = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
+ }
+
+ $this->noColors = $noColors;
+
+ $this->addPredefinedStyles();
+ }
+
+ /**
+ * Add a style.
+ *
+ * @param string $name The style name.
+ * @param ColorStyle $style The color style.
+ *
+ * @return $this
+ *
+ * @since 4.0.0
+ */
+ public function addStyle($name, ColorStyle $style)
+ {
+ $this->styles[$name] = $style;
+
+ return $this;
+ }
+
+ /**
+ * Strip color tags from a string.
+ *
+ * @param string $string The string.
+ *
+ * @return string
+ *
+ * @since 4.0.0
+ */
+ public static function stripColors($string)
+ {
+ return preg_replace(static::$stripFilter, '', $string);
+ }
+
+ /**
+ * Process a string.
+ *
+ * @param string $string The string to process.
+ *
+ * @return string
+ *
+ * @since 4.0.0
+ */
+ public function process($string)
+ {
+ preg_match_all($this->tagFilter, $string, $matches);
+
+ if (!$matches) {
+ return $string;
+ }
+
+ foreach ($matches[0] as $i => $m) {
+ if (\array_key_exists($matches[1][$i], $this->styles)) {
+ $string = $this->replaceColors($string, $matches[1][$i], $matches[2][$i], $this->styles[$matches[1][$i]]);
+ } elseif (strpos($matches[1][$i], '=')) {
+ // Custom format
+ $string = $this->replaceColors($string, $matches[1][$i], $matches[2][$i], ColorStyle::fromString($matches[1][$i]));
+ }
+ }
+
+ return $string;
+ }
+
+ /**
+ * Replace color tags in a string.
+ *
+ * @param string $text The original text.
+ * @param string $tag The matched tag.
+ * @param string $match The match.
+ * @param ColorStyle $style The color style to apply.
+ *
+ * @return mixed
+ *
+ * @since 4.0.0
+ */
+ private function replaceColors($text, $tag, $match, ColorStyle $style)
+ {
+ $replace = $this->noColors
+ ? $match
+ : "\033[" . $style . 'm' . $match . "\033[0m";
+
+ return str_replace('<' . $tag . '>' . $match . '' . $tag . '>', $replace, $text);
+ }
+
+ /**
+ * Adds predefined color styles to the ColorProcessor object
+ *
+ * @return $this
+ *
+ * @since 4.0.0
+ */
+ private function addPredefinedStyles()
+ {
+ $this->addStyle(
+ 'info',
+ new ColorStyle('green', '', ['bold'])
+ );
+
+ $this->addStyle(
+ 'comment',
+ new ColorStyle('yellow', '', ['bold'])
+ );
+
+ $this->addStyle(
+ 'question',
+ new ColorStyle('black', 'cyan')
+ );
+
+ $this->addStyle(
+ 'error',
+ new ColorStyle('white', 'red')
+ );
+
+ return $this;
+ }
+}
diff --git a/plugins/behaviour/compat/classes/Application/CLI/Output/Processor/ProcessorInterface.php b/plugins/behaviour/compat/classes/Application/CLI/Output/Processor/ProcessorInterface.php
new file mode 100644
index 0000000000000..2c7e0bdbcd47a
--- /dev/null
+++ b/plugins/behaviour/compat/classes/Application/CLI/Output/Processor/ProcessorInterface.php
@@ -0,0 +1,36 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Application\CLI\Output\Processor;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Interface for a command line output processor
+ *
+ * @since 4.0.0
+ *
+ * @deprecated 4.3 will be removed in 6.0
+ * Use the `joomla/console` package instead
+ */
+interface ProcessorInterface
+{
+ /**
+ * Process the provided output into a string.
+ *
+ * @param string $output The string to process.
+ *
+ * @return string
+ *
+ * @since 4.0.0
+ */
+ public function process($output);
+}
diff --git a/plugins/behaviour/compat/classes/Application/CLI/Output/Stdout.php b/plugins/behaviour/compat/classes/Application/CLI/Output/Stdout.php
new file mode 100644
index 0000000000000..ccae44b56ffa9
--- /dev/null
+++ b/plugins/behaviour/compat/classes/Application/CLI/Output/Stdout.php
@@ -0,0 +1,45 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Application\CLI\Output;
+
+use Joomla\CMS\Application\CLI\CliOutput;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Output handler for writing command line output to the stdout interface
+ *
+ * @since 4.0.0
+ *
+ * @deprecated 4.3 will be removed in 6.0
+ * Use the `joomla/console` package instead
+ */
+class Stdout extends CliOutput
+{
+ /**
+ * Write a string to standard output
+ *
+ * @param string $text The text to display.
+ * @param boolean $nl True (default) to append a new line at the end of the output string.
+ *
+ * @return $this
+ *
+ * @codeCoverageIgnore
+ * @since 4.0.0
+ */
+ public function out($text = '', $nl = true)
+ {
+ fwrite(STDOUT, $this->getProcessor()->process($text) . ($nl ? "\n" : null));
+
+ return $this;
+ }
+}
diff --git a/plugins/behaviour/compat/classes/Application/CLI/Output/Xml.php b/plugins/behaviour/compat/classes/Application/CLI/Output/Xml.php
new file mode 100644
index 0000000000000..36ab151db6441
--- /dev/null
+++ b/plugins/behaviour/compat/classes/Application/CLI/Output/Xml.php
@@ -0,0 +1,46 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Application\CLI\Output;
+
+use Joomla\CMS\Application\CLI\CliOutput;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Output handler for writing command line output to the stdout interface
+ *
+ * @since 4.0.0
+ *
+ * @deprecated 4.3 will be removed in 6.0
+ * Use the `joomla/console` package instead
+ */
+class Xml extends CliOutput
+{
+ /**
+ * Write a string to standard output.
+ *
+ * @param string $text The text to display.
+ * @param boolean $nl True (default) to append a new line at the end of the output string.
+ *
+ * @return $this
+ *
+ * @since 4.0.0
+ * @throws \RuntimeException
+ * @codeCoverageIgnore
+ */
+ public function out($text = '', $nl = true)
+ {
+ fwrite(STDOUT, $text . ($nl ? "\n" : null));
+
+ return $this;
+ }
+}
diff --git a/plugins/behaviour/compat/classes/Application/CliApplication.php b/plugins/behaviour/compat/classes/Application/CliApplication.php
new file mode 100644
index 0000000000000..9acaae1fc84ab
--- /dev/null
+++ b/plugins/behaviour/compat/classes/Application/CliApplication.php
@@ -0,0 +1,428 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Application;
+
+use Joomla\Application\AbstractApplication;
+use Joomla\CMS\Application\CLI\CliInput;
+use Joomla\CMS\Application\CLI\CliOutput;
+use Joomla\CMS\Application\CLI\Output\Stdout;
+use Joomla\CMS\Event\Application\AfterExecuteEvent;
+use Joomla\CMS\Event\Application\BeforeExecuteEvent;
+use Joomla\CMS\Extension\ExtensionManagerTrait;
+use Joomla\CMS\Factory;
+use Joomla\CMS\Language\Language;
+use Joomla\DI\Container;
+use Joomla\DI\ContainerAwareTrait;
+use Joomla\Event\DispatcherInterface;
+use Joomla\Input\Input;
+use Joomla\Registry\Registry;
+use Joomla\Session\SessionInterface;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Base class for a Joomla! command line application.
+ *
+ * @since 2.5.0
+ *
+ * @deprecated 4.0 will be removed in 6.0
+ * Use the ConsoleApplication instead
+ */
+abstract class CliApplication extends AbstractApplication implements CMSApplicationInterface
+{
+ use EventAware;
+ use IdentityAware;
+ use ContainerAwareTrait;
+ use ExtensionManagerTrait;
+ use ExtensionNamespaceMapper;
+
+ /**
+ * Output object
+ *
+ * @var CliOutput
+ * @since 4.0.0
+ */
+ protected $output;
+
+ /**
+ * The input.
+ *
+ * @var \Joomla\Input\Input
+ * @since 4.0.0
+ */
+ protected $input = null;
+
+ /**
+ * CLI Input object
+ *
+ * @var CliInput
+ * @since 4.0.0
+ */
+ protected $cliInput;
+
+ /**
+ * The application language object.
+ *
+ * @var Language
+ * @since 4.0.0
+ */
+ protected $language;
+
+ /**
+ * The application message queue.
+ *
+ * @var array
+ * @since 4.0.0
+ */
+ protected $messages = [];
+
+ /**
+ * The application instance.
+ *
+ * @var CliApplication
+ * @since 1.7.0
+ */
+ protected static $instance;
+
+ /**
+ * Class constructor.
+ *
+ * @param ?Input $input An optional argument to provide dependency injection for the application's
+ * input object. If the argument is a JInputCli object that object will become
+ * the application's input object, otherwise a default input object is created.
+ * @param ?Registry $config An optional argument to provide dependency injection for the application's
+ * config object. If the argument is a Registry object that object will become
+ * the application's config object, otherwise a default config object is created.
+ * @param ?CliOutput $output The output handler.
+ * @param ?CliInput $cliInput The CLI input handler.
+ * @param ?DispatcherInterface $dispatcher An optional argument to provide dependency injection for the application's
+ * event dispatcher. If the argument is a DispatcherInterface object that object will become
+ * the application's event dispatcher, if it is null then the default event dispatcher
+ * will be created based on the application's loadDispatcher() method.
+ * @param ?Container $container Dependency injection container.
+ *
+ * @since 1.7.0
+ */
+ public function __construct(
+ ?Input $input = null,
+ ?Registry $config = null,
+ ?CliOutput $output = null,
+ ?CliInput $cliInput = null,
+ ?DispatcherInterface $dispatcher = null,
+ ?Container $container = null
+ ) {
+ // Close the application if we are not executed from the command line.
+ if (!\defined('STDOUT') || !\defined('STDIN') || !isset($_SERVER['argv'])) {
+ $this->close();
+ }
+
+ $container = $container ?: Factory::getContainer();
+ $this->setContainer($container);
+ $this->setDispatcher($dispatcher ?: $container->get(\Joomla\Event\DispatcherInterface::class));
+
+ if (!$container->has('session')) {
+ $container->alias('session', 'session.cli')
+ ->alias('JSession', 'session.cli')
+ ->alias(\Joomla\CMS\Session\Session::class, 'session.cli')
+ ->alias(\Joomla\Session\Session::class, 'session.cli')
+ ->alias(\Joomla\Session\SessionInterface::class, 'session.cli');
+ }
+
+ $this->input = new \Joomla\CMS\Input\Cli();
+ $this->language = Factory::getLanguage();
+ $this->output = $output ?: new Stdout();
+ $this->cliInput = $cliInput ?: new CliInput();
+
+ parent::__construct($config);
+
+ // Set the current directory.
+ $this->set('cwd', getcwd());
+
+ // Set up the environment
+ $this->input->set('format', 'cli');
+ }
+
+ /**
+ * Magic method to access properties of the application.
+ *
+ * @param string $name The name of the property.
+ *
+ * @return mixed A value if the property name is valid, null otherwise.
+ *
+ * @since 4.0.0
+ *
+ * @deprecated 4.0 will be removed in 6.0
+ * This is a B/C proxy for deprecated read accesses
+ * Example: Factory::getApplication()->getInput();
+ */
+ public function __get($name)
+ {
+ switch ($name) {
+ case 'input':
+ @trigger_error(
+ 'Accessing the input property of the application is deprecated, use the getInput() method instead.',
+ E_USER_DEPRECATED
+ );
+
+ return $this->getInput();
+
+ default:
+ $trace = debug_backtrace();
+ trigger_error(
+ \sprintf(
+ 'Undefined property via __get(): %1$s in %2$s on line %3$s',
+ $name,
+ $trace[0]['file'],
+ $trace[0]['line']
+ ),
+ E_USER_NOTICE
+ );
+ }
+ }
+
+ /**
+ * Method to get the application input object.
+ *
+ * @return Input
+ *
+ * @since 4.0.0
+ */
+ public function getInput(): Input
+ {
+ return $this->input;
+ }
+
+ /**
+ * Method to get the application language object.
+ *
+ * @return Language The language object
+ *
+ * @since 4.0.0
+ */
+ public function getLanguage()
+ {
+ return $this->language;
+ }
+
+ /**
+ * Returns a reference to the global CliApplication object, only creating it if it doesn't already exist.
+ *
+ * This method must be invoked as: $cli = CliApplication::getInstance();
+ *
+ * @param string $name The name (optional) of the Application Cli class to instantiate.
+ *
+ * @return CliApplication
+ *
+ * @since 1.7.0
+ *
+ * @deprecated 4.0 will be removed in 6.0
+ * Load the app through the container or via the Factory
+ * Example: Factory::getContainer()->get(CliApplication::class)
+ *
+ * @throws \RuntimeException
+ */
+ public static function getInstance($name = null)
+ {
+ // Only create the object if it doesn't exist.
+ if (empty(static::$instance)) {
+ if (!class_exists($name)) {
+ throw new \RuntimeException(\sprintf('Unable to load application: %s', $name), 500);
+ }
+
+ static::$instance = new $name();
+ }
+
+ return static::$instance;
+ }
+
+ /**
+ * Execute the application.
+ *
+ * @return void
+ *
+ * @since 1.7.0
+ */
+ public function execute()
+ {
+ $this->createExtensionNamespaceMap();
+
+ // Trigger the onBeforeExecute event
+ $this->dispatchEvent(
+ 'onBeforeExecute',
+ new BeforeExecuteEvent('onBeforeExecute', ['subject' => $this, 'container' => $this->getContainer()])
+ );
+
+ // Perform application routines.
+ $this->doExecute();
+
+ // Trigger the onAfterExecute event.
+ $this->dispatchEvent(
+ 'onAfterExecute',
+ new AfterExecuteEvent('onAfterExecute', ['subject' => $this])
+ );
+ }
+
+ /**
+ * Get an output object.
+ *
+ * @return CliOutput
+ *
+ * @since 4.0.0
+ */
+ public function getOutput()
+ {
+ return $this->output;
+ }
+
+ /**
+ * Get a CLI input object.
+ *
+ * @return CliInput
+ *
+ * @since 4.0.0
+ */
+ public function getCliInput()
+ {
+ return $this->cliInput;
+ }
+
+ /**
+ * Write a string to standard output.
+ *
+ * @param string $text The text to display.
+ * @param boolean $nl True (default) to append a new line at the end of the output string.
+ *
+ * @return $this
+ *
+ * @since 4.0.0
+ */
+ public function out($text = '', $nl = true)
+ {
+ $this->getOutput()->out($text, $nl);
+
+ return $this;
+ }
+
+ /**
+ * Get a value from standard input.
+ *
+ * @return string The input string from standard input.
+ *
+ * @codeCoverageIgnore
+ * @since 4.0.0
+ */
+ public function in()
+ {
+ return $this->getCliInput()->in();
+ }
+
+ /**
+ * Set an output object.
+ *
+ * @param CliOutput $output CliOutput object
+ *
+ * @return $this
+ *
+ * @since 3.3
+ */
+ public function setOutput(CliOutput $output)
+ {
+ $this->output = $output;
+
+ return $this;
+ }
+
+ /**
+ * Enqueue a system message.
+ *
+ * @param string $msg The message to enqueue.
+ * @param string $type The message type.
+ *
+ * @return void
+ *
+ * @since 4.0.0
+ */
+ public function enqueueMessage($msg, $type = self::MSG_INFO)
+ {
+ if (!\array_key_exists($type, $this->messages)) {
+ $this->messages[$type] = [];
+ }
+
+ $this->messages[$type][] = $msg;
+ }
+
+ /**
+ * Get the system message queue.
+ *
+ * @return array The system message queue.
+ *
+ * @since 4.0.0
+ */
+ public function getMessageQueue()
+ {
+ return $this->messages;
+ }
+
+ /**
+ * Check the client interface by name.
+ *
+ * @param string $identifier String identifier for the application interface
+ *
+ * @return boolean True if this application is of the given type client interface.
+ *
+ * @since 4.0.0
+ */
+ public function isClient($identifier)
+ {
+ return $identifier === 'cli';
+ }
+
+ /**
+ * Method to get the application session object.
+ *
+ * @return SessionInterface The session object
+ *
+ * @since 4.0.0
+ */
+ public function getSession()
+ {
+ return $this->container->get(SessionInterface::class);
+ }
+
+ /**
+ * Retrieve the application configuration object.
+ *
+ * @return Registry
+ *
+ * @since 4.0.0
+ */
+ public function getConfig()
+ {
+ return $this->config;
+ }
+
+ /**
+ * Flag if the application instance is a CLI or web based application.
+ *
+ * Helper function, you should use the native PHP functions to detect if it is a CLI application.
+ *
+ * @return boolean
+ *
+ * @since 4.0.0
+ * @deprecated 4.0 will be removed in 6.0
+ * Will be removed without replacements
+ */
+ public function isCli()
+ {
+ return true;
+ }
+}
diff --git a/plugins/behaviour/compat/compat.xml b/plugins/behaviour/compat/compat.xml
index 60a6d3a29909f..2e7ebb14983fa 100644
--- a/plugins/behaviour/compat/compat.xml
+++ b/plugins/behaviour/compat/compat.xml
@@ -11,6 +11,7 @@
PLG_COMPAT_XML_DESCRIPTION
Joomla\Plugin\Behaviour\Compat
+ classes
services
src
diff --git a/plugins/behaviour/compat/src/Extension/Compat.php b/plugins/behaviour/compat/src/Extension/Compat.php
index 250b48ec0bd60..3621783f74e2d 100644
--- a/plugins/behaviour/compat/src/Extension/Compat.php
+++ b/plugins/behaviour/compat/src/Extension/Compat.php
@@ -79,7 +79,7 @@ public function __construct(DispatcherInterface $dispatcher, array $config = [])
* Include classes which are removed in 7.0
*/
if ($this->params->get('legacy_classes', '1')) {
- \JLoader::registerNamespace('\\Joomla\\CMS\\Filesystem', JPATH_PLUGINS . '/behaviour/compat/classes/Filesystem');
+ \JLoader::registerNamespace('\\Joomla\\CMS', JPATH_PLUGINS . '/behaviour/compat/classes');
}
/**
diff --git a/plugins/behaviour/compat/src/classmap/classmap.php b/plugins/behaviour/compat/src/classmap/classmap.php
index c61b068b606d5..f00eb728cff62 100644
--- a/plugins/behaviour/compat/src/classmap/classmap.php
+++ b/plugins/behaviour/compat/src/classmap/classmap.php
@@ -467,6 +467,22 @@
JLoader::registerAlias('JHtml', '\\Joomla\\CMS\\HTML\\HTMLHelper', '6.0');
+JLoader::registerAlias('\\Joomla\\Application\\Cli\\CliInput', '\\Joomla\\CMS\\Application\\CLI\\CliInput', '6.0');
+JLoader::registerAlias('\\Joomla\\Application\\Cli\\CliOutput', '\\Joomla\\CMS\\Application\\CLI\\CliOutput', '6.0');
+JLoader::registerAlias('\\Joomla\\Application\\Cli\\ColorStyle', '\\Joomla\\CMS\\Application\\CLI\\ColorStyle', '6.0');
+JLoader::registerAlias('\\Joomla\\Application\\Cli\\Output\\Stdout', '\\Joomla\\CMS\\Application\\CLI\\Output\\Stdout', '6.0');
+JLoader::registerAlias('\\Joomla\\Application\\Cli\\Output\\Xml', '\\Joomla\\CMS\\Application\\CLI\\Output\\Xml', '6.0');
+JLoader::registerAlias(
+ '\\Joomla\\Application\\Cli\\Output\\Processor\\ColorProcessor',
+ '\\Joomla\\CMS\\Application\\CLI\\Output\\Processor\\ColorProcessor',
+ '6.0'
+);
+JLoader::registerAlias(
+ '\\Joomla\\Application\\Cli\\Output\\Processor\\ProcessorInterface',
+ '\\Joomla\\CMS\\Application\\CLI\\Output\\Processor\\ProcessorInterface',
+ '6.0'
+);
+
JLoader::registerAlias('JFile', '\\Joomla\\CMS\\Filesystem\\File', '6.0');
JLoader::registerAlias('JFolder', '\\Joomla\\CMS\\Filesystem\\Folder', '6.0');
JLoader::registerAlias('JFilesystemHelper', '\\Joomla\\CMS\\Filesystem\\FilesystemHelper', '6.0');