mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/14492] Allow specifying extensions to update & install
PHPBB3-14492
This commit is contained in:
parent
eb1ade6768
commit
65d6e338a9
4 changed files with 34 additions and 1 deletions
|
@ -330,6 +330,7 @@ $lang = array_merge($lang, array(
|
||||||
$lang = array_merge($lang, array(
|
$lang = array_merge($lang, array(
|
||||||
'CLI_INSTALL_BOARD' => 'Install phpBB',
|
'CLI_INSTALL_BOARD' => 'Install phpBB',
|
||||||
'CLI_UPDATE_BOARD' => 'Update phpBB',
|
'CLI_UPDATE_BOARD' => 'Update phpBB',
|
||||||
|
'CLI_INSTALL_EXTENSIONS' => 'Extensions to install. Multiple extensions can be specified using a comma separated list.',
|
||||||
'CLI_INSTALL_SHOW_CONFIG' => 'Show the configuration which will be used',
|
'CLI_INSTALL_SHOW_CONFIG' => 'Show the configuration which will be used',
|
||||||
'CLI_INSTALL_VALIDATE_CONFIG' => 'Validate a configuration file',
|
'CLI_INSTALL_VALIDATE_CONFIG' => 'Validate a configuration file',
|
||||||
'CLI_CONFIG_FILE' => 'Config file to use',
|
'CLI_CONFIG_FILE' => 'Config file to use',
|
||||||
|
|
|
@ -80,6 +80,10 @@ class install extends \phpbb\console\command\command
|
||||||
'config-file',
|
'config-file',
|
||||||
InputArgument::REQUIRED,
|
InputArgument::REQUIRED,
|
||||||
$this->language->lang('CLI_CONFIG_FILE'))
|
$this->language->lang('CLI_CONFIG_FILE'))
|
||||||
|
->addArgument(
|
||||||
|
'install-extensions',
|
||||||
|
InputArgument::OPTIONAL,
|
||||||
|
$this->language->lang('CLI_INSTALL_EXTENSIONS'))
|
||||||
->setDescription($this->language->lang('CLI_INSTALL_BOARD'))
|
->setDescription($this->language->lang('CLI_INSTALL_BOARD'))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -147,6 +151,7 @@ class install extends \phpbb\console\command\command
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->register_configuration($iohandler, $config);
|
$this->register_configuration($iohandler, $config);
|
||||||
|
$this->register_install_extensions($iohandler, $input);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -204,4 +209,17 @@ class install extends \phpbb\console\command\command
|
||||||
$iohandler->set_input('script_path', $config['server']['script_path']);
|
$iohandler->set_input('script_path', $config['server']['script_path']);
|
||||||
$iohandler->set_input('submit_server', 'submit');
|
$iohandler->set_input('submit_server', 'submit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register extensions to install during installation
|
||||||
|
*
|
||||||
|
* @param cli_iohandler $iohandler
|
||||||
|
* @param InputInterface $input
|
||||||
|
*/
|
||||||
|
private function register_install_extensions(cli_iohandler $iohandler, InputInterface $input)
|
||||||
|
{
|
||||||
|
$install_extensions = $input->getArgument('install-extensions');
|
||||||
|
$install_extensions = !empty($install_extensions) ? explode(',', $install_extensions) : array();
|
||||||
|
$iohandler->set_input('install-extensions', $install_extensions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
namespace phpbb\install\module\install_finish\task;
|
namespace phpbb\install\module\install_finish\task;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs extensions that exist in ext folder upon install
|
* Installs extensions that exist in ext folder upon install
|
||||||
*/
|
*/
|
||||||
|
@ -100,12 +102,19 @@ class install_extensions extends \phpbb\install\task_base
|
||||||
$this->user->session_begin();
|
$this->user->session_begin();
|
||||||
$this->user->setup(array('common', 'acp/common', 'cli'));
|
$this->user->setup(array('common', 'acp/common', 'cli'));
|
||||||
|
|
||||||
|
$install_extensions = $this->iohandler->get_input('install-extensions', array());
|
||||||
|
|
||||||
// Find available extensions
|
// Find available extensions
|
||||||
foreach ($this->finder as $file)
|
foreach ($this->finder as $file)
|
||||||
{
|
{
|
||||||
/** @var \SplFileInfo $file */
|
/** @var \SplFileInfo $file */
|
||||||
$ext_name = preg_replace('#(.+[\\/\\\]ext[\\/\\\])(\w+)[\\/\\\](\w+)#', '$2/$3', dirname($file->getRealPath()));
|
$ext_name = preg_replace('#(.+[\\/\\\]ext[\\/\\\])(\w+)[\\/\\\](\w+)#', '$2/$3', dirname($file->getRealPath()));
|
||||||
|
|
||||||
|
if (!empty($install_extensions) && !in_array($ext_name, $install_extensions))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->extension_manager->is_available($ext_name))
|
if ($this->extension_manager->is_available($ext_name))
|
||||||
{
|
{
|
||||||
$this->extension_manager->enable($ext_name);
|
$this->extension_manager->enable($ext_name);
|
||||||
|
|
|
@ -18,6 +18,7 @@ use phpbb\install\helper\config;
|
||||||
use phpbb\install\helper\iohandler\iohandler_interface;
|
use phpbb\install\helper\iohandler\iohandler_interface;
|
||||||
use phpbb\install\helper\update_helper;
|
use phpbb\install\helper\update_helper;
|
||||||
use phpbb\install\task_base;
|
use phpbb\install\task_base;
|
||||||
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,6 +112,9 @@ class enable_extensions extends task_base
|
||||||
$this->user->session_begin();
|
$this->user->session_begin();
|
||||||
$this->user->setup(array('common', 'acp/common', 'cli'));
|
$this->user->setup(array('common', 'acp/common', 'cli'));
|
||||||
|
|
||||||
|
$input = new ArgvInput();
|
||||||
|
$update_extensions = explode(',', $input->getArgument('update-extensions'));
|
||||||
|
|
||||||
$update_info = $this->install_config->get('update_info_unprocessed', array());
|
$update_info = $this->install_config->get('update_info_unprocessed', array());
|
||||||
|
|
||||||
if (!empty($update_info))
|
if (!empty($update_info))
|
||||||
|
@ -122,7 +126,8 @@ class enable_extensions extends task_base
|
||||||
$ext_name = preg_replace('#(.+[\\/\\\]ext[\\/\\\])(\w+)[\\/\\\](\w+)#', '$2/$3', dirname($file->getRealPath()));
|
$ext_name = preg_replace('#(.+[\\/\\\]ext[\\/\\\])(\w+)[\\/\\\](\w+)#', '$2/$3', dirname($file->getRealPath()));
|
||||||
|
|
||||||
// Skip extensions that were not added or updated during update
|
// Skip extensions that were not added or updated during update
|
||||||
if (!count(preg_grep('#ext/' . $ext_name . '#', $update_info['files'])))
|
if (!count(preg_grep('#ext/' . $ext_name . '#', $update_info['files'])) &&
|
||||||
|
!in_array($ext_name, $update_extensions) && $ext_name !== 'phpbb/viglink')
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue