Skip to content
Closed
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
22 changes: 16 additions & 6 deletions libraries/src/Console/ExtensionDiscoverInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,18 @@ class ExtensionDiscoverInstallCommand extends AbstractCommand
* Database connector
*
* @var DatabaseInterface
* @since 4.0.0
* @since __DEPLOY_VERSION__
*/
private $db;

/**
* Installer
*
* @var Installer Installer object
* @since __DEPLOY_VERSION__
*/
private $installer = null;

/**
* Exit Code For Discover Failure
*
Expand All @@ -74,13 +82,15 @@ class ExtensionDiscoverInstallCommand extends AbstractCommand
/**
* Instantiate the command.
*
* @param DatabaseInterface $db Database connector
* @param DatabaseInterface $db Database connector
* @param Installer $installer Installer object
*
* @since __DEPLOY_VERSION__
*/
public function __construct(DatabaseInterface $db)
public function __construct(DatabaseInterface $db, Installer $installer)
{
$this->db = $db;
$this->installer = $installer;
parent::__construct();
}

Expand Down Expand Up @@ -134,7 +144,7 @@ protected function configure(): void
*/
public function processDiscover($eid): bool
{
$jInstaller = new Installer;
$installer = $this->installer;
$result = true;

if ($eid === -1)
Expand All @@ -149,7 +159,7 @@ public function processDiscover($eid): bool

foreach ($eidsToDiscover as $eidToDiscover)
{
if (!$jInstaller->discover_install($eidToDiscover->extension_id))
if (!$installer->discover_install($eidToDiscover->extension_id))
{
$this->ioStyle->warning('There was a problem installing the extension with ID ' . $eidToDiscover->extension_id . '.');
$result = false;
Expand All @@ -165,7 +175,7 @@ public function processDiscover($eid): bool
}
else
{
return $jInstaller->discover_install($eid);
return $installer->discover_install($eid);
}
}

Expand Down
3 changes: 2 additions & 1 deletion libraries/src/Service/Provider/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Joomla\CMS\Console\SiteDownCommand;
use Joomla\CMS\Console\SiteUpCommand;
use Joomla\CMS\Console\UpdateCoreCommand;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Session\MetadataManager;
use Joomla\Database\Command\ExportCommand;
use Joomla\Database\Command\ImportCommand;
Expand Down Expand Up @@ -167,7 +168,7 @@ function (Container $container)
ExtensionDiscoverInstallCommand::class,
function (Container $container)
{
return new ExtensionDiscoverInstallCommand($container->get('db'));
return new ExtensionDiscoverInstallCommand($container->get('db'), new Installer);
},
true
);
Expand Down