1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/11150] Add ability to manage extensions through composer

PHPBB3-11150
This commit is contained in:
Tristan Darricau
2015-09-09 19:56:52 +02:00
committed by Tristan Darricau
parent 712626d845
commit fbb85e2f4f
13 changed files with 1523 additions and 64 deletions

View File

@@ -0,0 +1,72 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\console\command\extension;
use phpbb\composer\manager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class install extends \phpbb\console\command\command
{
/**
* @var \phpbb\composer\manager Composer extensions manager
*/
protected $manager;
public function __construct(\phpbb\user $user, manager $manager)
{
$this->manager = $manager;
parent::__construct($user);
}
/**
* Sets the command name and description
*
* @return null
*/
protected function configure()
{
$this
->setName('extension:install')
->setDescription($this->user->lang('CLI_DESCRIPTION_EXTENSION_INSTALL'))
->addArgument(
'extensions',
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
$this->user->lang('CLI_DESCRIPTION_EXTENSION_INSTALL'))
;
}
/**
* Executes the command extension:install
*
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$extensions = $input->getArgument('extensions');
$this->manager->install($extensions);
$io->success('All extensions installed');
return 0;
}
}

View File

@@ -0,0 +1,75 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\console\command\extension;
use Composer\Package\CompletePackage;
use Composer\Package\PackageInterface;
use phpbb\composer\installer;
use phpbb\composer\manager;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class list_available extends \phpbb\console\command\command
{
/**
* @var \phpbb\composer\manager Composer extensions manager
*/
protected $manager;
public function __construct(\phpbb\user $user, manager $manager)
{
$this->manager = $manager;
parent::__construct($user);
}
/**
* Sets the command name and description
*
* @return null
*/
protected function configure()
{
$this
->setName('extension:list-available')
->setDescription($this->user->lang('CLI_DESCRIPTION_EXTENSION_LIST_AVAILABLE'))
;
}
/**
* Executes the command extension:install
*
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$extensions = [];
foreach ($this->manager->get_available_packages() as $package)
{
$extensions[] = '<info>' . $package['name'] . '</info> <comment>' . $package['url'] . "</comment>\n" . $package['description'];
}
$io->listing($extensions);
return 0;
}
}

View File

@@ -0,0 +1,72 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\console\command\extension;
use phpbb\composer\manager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class remove extends \phpbb\console\command\command
{
/**
* @var \phpbb\composer\manager Composer extensions manager
*/
protected $manager;
public function __construct(\phpbb\user $user, manager $manager)
{
$this->manager = $manager;
parent::__construct($user);
}
/**
* Sets the command name and description
*
* @return null
*/
protected function configure()
{
$this
->setName('extension:remove')
->setDescription($this->user->lang('CLI_DESCRIPTION_EXTENSION_REMOVE'))
->addArgument(
'extensions',
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
$this->user->lang('CLI_DESCRIPTION_EXTENSION_REMOVE'))
;
}
/**
* Executes the command extension:install
*
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$extensions = $input->getArgument('extensions');
$this->manager->remove($extensions);
$io->success('All extensions removed');
return 0;
}
}

View File

@@ -0,0 +1,72 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\console\command\extension;
use phpbb\composer\manager;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class update extends \phpbb\console\command\command
{
/**
* @var \phpbb\composer\manager Composer extensions manager
*/
protected $manager;
public function __construct(\phpbb\user $user, manager $manager)
{
$this->manager = $manager;
parent::__construct($user);
}
/**
* Sets the command name and description
*
* @return null
*/
protected function configure()
{
$this
->setName('extension:update')
->setDescription($this->user->lang('CLI_DESCRIPTION_EXTENSION_UPDATE'))
->addArgument(
'extensions',
InputArgument::IS_ARRAY | InputArgument::REQUIRED,
$this->user->lang('CLI_DESCRIPTION_EXTENSION_UPDATE'))
;
}
/**
* Executes the command extension:install
*
* @param InputInterface $input
* @param OutputInterface $output
* @return integer
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$extensions = $input->getArgument('extensions');
$this->manager->update($extensions);
$io->success('All extensions updated');
return 0;
}
}