Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion libraries/src/Console/ExtensionDiscoverCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Installer\InstallerHelper;
use Joomla\Console\Command\AbstractCommand;
use Joomla\Database\DatabaseInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -48,6 +49,14 @@ class ExtensionDiscoverCommand extends AbstractCommand
*/
private $ioStyle;

/**
* Database connector
*
* @var DatabaseInterface
* @since 4.0.0
*/
private $db;

/**
* Exit Code For Discover Failure
* @since
Expand All @@ -60,6 +69,19 @@ class ExtensionDiscoverCommand extends AbstractCommand
*/
public const DISCOVER_SUCCESSFUL = 0;

/**
* Instantiate the command.
*
* @param DatabaseInterface $db Database connector
*
* @since 4.0.0
*/
public function __construct(DatabaseInterface $db)
{
$this->db = $db;
parent::__construct();
}

/**
* Configures the IO
*
Expand Down Expand Up @@ -115,7 +137,7 @@ public function processDiscover($eid): bool

if ($eid === -1)
{
$db = Factory::getDbo();
$db = $this->db;
$query = $db->getQuery(true)
->select($db->quoteName(['extension_id']))
->from($db->quoteName('#__extensions'))
Expand Down
2 changes: 1 addition & 1 deletion libraries/src/Service/Provider/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function (Container $container)
ExtensionDiscoverCommand::class,
function (Container $container)
{
return new ExtensionDiscoverCommand;
return new ExtensionDiscoverCommand($container->get('db'));
},
true
);
Expand Down