mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-25 18:13:28 +01:00
[ticket/14492] Install all packaged extensions by default
PHPBB3-14492
This commit is contained in:
parent
36460ebdf6
commit
8fb2347cfa
@ -7,6 +7,16 @@ services:
|
||||
tags:
|
||||
- { name: install_finish, order: 10 }
|
||||
|
||||
installer.install_finish.install_viglink:
|
||||
class: phpbb\install\module\install_finish\task\install_extensions
|
||||
arguments:
|
||||
- '@installer.helper.container_factory'
|
||||
- '@installer.helper.config'
|
||||
- '@installer.helper.iohandler'
|
||||
- '%core.root_path%'
|
||||
tags:
|
||||
- { name: install_finish, order: 20 }
|
||||
|
||||
installer.install_finish.notify_user:
|
||||
class: phpbb\install\module\install_finish\task\notify_user
|
||||
arguments:
|
||||
@ -16,16 +26,7 @@ services:
|
||||
- '%core.root_path%'
|
||||
- '%core.php_ext%'
|
||||
tags:
|
||||
- { name: install_finish, order: 20 }
|
||||
|
||||
installer.install_finish.install_viglink:
|
||||
class: phpbb\install\module\install_finish\task\install_viglink
|
||||
arguments:
|
||||
- @installer.helper.container_factory
|
||||
- @installer.helper.config
|
||||
- @installer.helper.iohandler
|
||||
tags:
|
||||
- { name: install_finish, order: 15 }
|
||||
- { name: install_finish, order: 30 }
|
||||
|
||||
installer.module.install_finish_collection:
|
||||
class: phpbb\di\ordered_service_collection
|
||||
|
@ -301,7 +301,7 @@ $lang = array_merge($lang, array(
|
||||
'TASK_ADD_MODULES' => 'Installing modules',
|
||||
|
||||
// Install finish tasks
|
||||
'TASK_INSTALL_VIGLINK' => 'Installing viglink extension',
|
||||
'TASK_INSTALL_EXTENSIONS' => 'Installing packaged extensions',
|
||||
'TASK_NOTIFY_USER' => 'Sending notification e-mail',
|
||||
'TASK_POPULATE_MIGRATIONS' => 'Populating migrations',
|
||||
|
||||
|
@ -14,9 +14,9 @@
|
||||
namespace phpbb\install\module\install_finish\task;
|
||||
|
||||
/**
|
||||
* Installs viglink extension with default config
|
||||
* Installs extensions that exist in ext folder upon install
|
||||
*/
|
||||
class install_viglink extends \phpbb\install\task_base
|
||||
class install_extensions extends \phpbb\install\task_base
|
||||
{
|
||||
/**
|
||||
* @var \phpbb\install\helper\config
|
||||
@ -46,14 +46,18 @@ class install_viglink extends \phpbb\install\task_base
|
||||
/** @var \phpbb\extension\manager */
|
||||
protected $extension_manager;
|
||||
|
||||
/** @var \Symfony\Component\Finder\Finder */
|
||||
protected $finder;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \phpbb\install\helper\container_factory $container
|
||||
* @param \phpbb\install\helper\config $install_config
|
||||
* @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
*/
|
||||
public function __construct(\phpbb\install\helper\container_factory $container, \phpbb\install\helper\config $install_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler)
|
||||
public function __construct(\phpbb\install\helper\container_factory $container, \phpbb\install\helper\config $install_config, \phpbb\install\helper\iohandler\iohandler_interface $iohandler, $phpbb_root_path)
|
||||
{
|
||||
$this->install_config = $install_config;
|
||||
$this->iohandler = $iohandler;
|
||||
@ -62,6 +66,12 @@ class install_viglink extends \phpbb\install\task_base
|
||||
$this->user = $container->get('user');
|
||||
$this->extension_manager = $container->get('ext.manager');
|
||||
$this->config = $container->get('config');
|
||||
$this->finder = new \Symfony\Component\Finder\Finder();
|
||||
$this->finder->in($phpbb_root_path . 'ext/')
|
||||
->ignoreUnreadableDirs()
|
||||
->depth('< 3')
|
||||
->files()
|
||||
->name('composer.json');
|
||||
|
||||
// Make sure asset version exists in config. Otherwise we might try to
|
||||
// insert the assets_version setting into the database and cause a
|
||||
@ -83,21 +93,27 @@ class install_viglink extends \phpbb\install\task_base
|
||||
$this->user->setup(array('common', 'acp/common', 'cli'));
|
||||
$name = 'phpbb/viglink';
|
||||
|
||||
// Should be available by default but make sure it is
|
||||
if ($this->extension_manager->is_available($name))
|
||||
// Find available extensions
|
||||
foreach ($this->finder as $file)
|
||||
{
|
||||
$this->extension_manager->enable($name);
|
||||
$this->extension_manager->load_extensions();
|
||||
/** @var \SplFileInfo $file */
|
||||
$ext_name = preg_replace('#(.+ext[\\/\\\])#', '', dirname($file->getRealPath()));
|
||||
|
||||
if (!$this->extension_manager->is_enabled($name))
|
||||
if ($this->extension_manager->is_available($ext_name))
|
||||
{
|
||||
// Create log
|
||||
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name));
|
||||
$this->extension_manager->enable($ext_name);
|
||||
$this->extension_manager->load_extensions();
|
||||
|
||||
if (!$this->extension_manager->is_enabled($ext_name))
|
||||
{
|
||||
// Create log
|
||||
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($ext_name));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->iohandler->add_log_message('CLI_EXTENSION_ENABLE_FAILURE', array($ext_name));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->iohandler->add_log_message('CLI_EXTENSION_ENABLE_FAILURE', array('phpbb/viglink'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,6 +130,6 @@ class install_viglink extends \phpbb\install\task_base
|
||||
*/
|
||||
public function get_task_lang_name()
|
||||
{
|
||||
return 'TASK_INSTALL_VIGLINK';
|
||||
return 'TASK_INSTALL_EXTENSIONS';
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user