1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-25 18:13:28 +01:00

[ticket/14492] Add basic task for installing viglink extension

PHPBB3-14492
This commit is contained in:
Marc Alexander 2015-12-07 09:59:47 +01:00
parent 487df8befc
commit c30394ff4a
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
3 changed files with 129 additions and 0 deletions

View File

@ -18,6 +18,15 @@ services:
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 }
installer.module.install_finish_collection:
class: phpbb\di\ordered_service_collection
arguments:

View File

@ -301,6 +301,7 @@ $lang = array_merge($lang, array(
'TASK_ADD_MODULES' => 'Installing modules',
// Install finish tasks
'TASK_INSTALL_VIGLINK' => 'Installing viglink extension',
'TASK_NOTIFY_USER' => 'Sending notification e-mail',
'TASK_POPULATE_MIGRATIONS' => 'Populating migrations',

View File

@ -0,0 +1,119 @@
<?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\install\module\install_finish\task;
/**
* Installs viglink extension with default config
*/
class install_viglink extends \phpbb\install\task_base
{
/**
* @var \phpbb\install\helper\config
*/
protected $install_config;
/**
* @var \phpbb\install\helper\iohandler\iohandler_interface
*/
protected $iohandler;
/**
* @var \phpbb\config\db
*/
protected $config;
/**
* @var \phpbb\log\log_interface
*/
protected $log;
/**
* @var \phpbb\user
*/
protected $user;
/** @var \phpbb\extension\manager */
protected $extension_manager;
/**
* Constructor
*
* @param \phpbb\install\helper\container_factory $container
* @param \phpbb\install\helper\config $install_config
* @param \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)
{
$this->install_config = $install_config;
$this->iohandler = $iohandler;
$this->log = $container->get('log');
$this->user = $container->get('user');
$this->extension_manager = $container->get('ext.manager');
$this->config = $container->get('config');
// Make sure asset version exists in config. Otherwise we might try to
// insert the assets_version setting into the database and cause a
// duplicate entry error.
if (!isset($this->config['assets_version']))
{
$this->config['assets_version'] = 0;
}
parent::__construct(true);
}
/**
* {@inheritdoc}
*/
public function run()
{
$this->user->session_begin();
$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))
{
$this->extension_manager->enable($name);
$this->extension_manager->load_extensions();
if (!$this->extension_manager->is_enabled($name))
{
// Create log
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name));
}
}
else
{
$this->iohandler->add_log_message('CLI_EXTENSION_ENABLE_FAILURE', array('phpbb/viglink'));
}
}
/**
* {@inheritdoc}
*/
static public function get_step_count()
{
return 1;
}
/**
* {@inheritdoc}
*/
public function get_task_lang_name()
{
return 'TASK_INSTALL_VIGLINK';
}
}