-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated command to allow choosing application "client"
- Loading branch information
Showing
5 changed files
with
81 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace Weble\JoomlaCommands\Application; | ||
|
||
use Joomla\CMS\Application\CliApplication; | ||
use Joomla\CMS\Application\CMSApplication; | ||
use Joomla\CMS\Factory; | ||
use Joomla\CMS\Plugin\PluginHelper; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class Application extends \Symfony\Component\Console\Application | ||
{ | ||
/** | ||
* @var InputInterface | ||
*/ | ||
protected $input; | ||
/** | ||
* @var OutputInterface | ||
*/ | ||
protected $output; | ||
/** | ||
* @var CliApplication | ||
*/ | ||
protected $joomlaCliApplication; | ||
|
||
public function doRun(InputInterface $input, OutputInterface $output) | ||
{ | ||
$this->input = $input; | ||
$this->output = $output; | ||
|
||
$this->configureJoomlaApplication(); | ||
$this->loadCommandsFromPlugins(); | ||
|
||
|
||
return parent::doRun($input, $output); // TODO: Change the autogenerated stub | ||
} | ||
|
||
public function setJoomlaCliApplication(CliApplication $app): self | ||
{ | ||
$this->joomlaCliApplication = $app; | ||
return $this; | ||
} | ||
|
||
protected function configureJoomlaApplication() | ||
{ | ||
$clientId = $this->input->hasParameterOption(['--ansi'], true) ?: 'site'; | ||
$application = CMSApplication::getInstance($clientId); | ||
|
||
Factory::$application = $application; | ||
} | ||
|
||
protected function loadCommandsFromPlugins() | ||
{ | ||
PluginHelper::importPlugin('console', null, true); | ||
$this->joomlaCliApplication->triggerEvent('onGetConsoleCommands', [$this]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<extension type="library" version="3.9" method="upgrade"> | ||
<!-- Please use a unique name to make uninstall to work. Should be identical to your manifest filename. --> | ||
<name>Joomla Commands - Library</name> | ||
<libraryname>joomla-commands</libraryname> | ||
<author>Weble Srl</author> | ||
<version>1.0.0</version> | ||
<creationDate>April 2020</creationDate> | ||
<copyright>(C) 2020 Weble Srl</copyright> | ||
<license>MIT</license> | ||
<authorEmail>[email protected]</authorEmail> | ||
<authorUrl>http://www.weble.it</authorUrl> | ||
<description>Joomla Commands - Library</description> | ||
|
||
<files> | ||
<folder>vendor</folder> | ||
<file>joomla-commands.xml</file> | ||
</files> | ||
</extension> |