Skip to content

Commit

Permalink
Move default command registration
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Babker committed Nov 16, 2017
1 parent d481653 commit b4743a8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
20 changes: 20 additions & 0 deletions libraries/src/Application/ConsoleApplication.php
Expand Up @@ -10,6 +10,7 @@

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Console;
use Joomla\CMS\Input\Cli;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Console\Application;
Expand Down Expand Up @@ -163,6 +164,25 @@ public function enqueueMessage($msg, $type = self::MSG_INFO)
$this->messages[$type][] = $msg;
}

/**
* Get the commands which should be registered by default to the application.
*
* @return CommandInterface[]
*
* @since __DEPLOY_VERSION__
*/
protected function getDefaultCommands(): array
{
return array_merge(
parent::getDefaultCommands(),
[
new Console\CleanCacheCommand,
new Console\CheckUpdatesCommand,
new Console\RemoveOldFilesCommand,
]
);
}

/**
* Get the system message queue.
*
Expand Down
8 changes: 0 additions & 8 deletions libraries/src/Service/Provider/Application.php
Expand Up @@ -11,9 +11,6 @@

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Console\CheckUpdatesCommand;
use Joomla\CMS\Console\CleanCacheCommand;
use Joomla\CMS\Console\RemoveOldFilesCommand;
use Joomla\Console\Application as BaseConsoleApplication;
use Joomla\CMS\Application\AdministratorApplication;
use Joomla\CMS\Application\ConsoleApplication;
Expand Down Expand Up @@ -104,11 +101,6 @@ function (Container $container)
$app->setLogger(Log::createDelegatedLogger());
$app->setSession($session);

// Register core commands
$app->addCommand(new CleanCacheCommand);
$app->addCommand(new CheckUpdatesCommand);
$app->addCommand(new RemoveOldFilesCommand);

return $app;
},
true
Expand Down

0 comments on commit b4743a8

Please sign in to comment.