mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/13867] Enable/disable mechanism for new profile field types
Adds methods to enable, disable and purge profile field types to the profilefields\manager class. These methods are to be called from extensions that add new profile field types on the enable, disable and purge methods of the ext class. If not done, any profile field of a new type that is left after extension is disabled or removed will break the forum in several places. Remove dependency from container, add dependencies with specific classes. Change try/catch by !isset. PHPBB3-13867
This commit is contained in:
parent
78ea308608
commit
b89539a70e
2 changed files with 19 additions and 19 deletions
|
@ -2,14 +2,15 @@ services:
|
||||||
profilefields.manager:
|
profilefields.manager:
|
||||||
class: phpbb\profilefields\manager
|
class: phpbb\profilefields\manager
|
||||||
arguments:
|
arguments:
|
||||||
- '@service_container'
|
|
||||||
- '@auth'
|
- '@auth'
|
||||||
- '@dbal.conn'
|
- '@dbal.conn'
|
||||||
|
- '@dbal.tools'
|
||||||
- '@dispatcher'
|
- '@dispatcher'
|
||||||
- '@request'
|
- '@request'
|
||||||
- '@template'
|
- '@template'
|
||||||
- '@profilefields.type_collection'
|
- '@profilefields.type_collection'
|
||||||
- '@user'
|
- '@user'
|
||||||
|
- '@config_text'
|
||||||
- '%tables.profile_fields%'
|
- '%tables.profile_fields%'
|
||||||
- '%tables.profile_fields_language%'
|
- '%tables.profile_fields_language%'
|
||||||
- '%tables.profile_fields_data%'
|
- '%tables.profile_fields_data%'
|
||||||
|
|
|
@ -13,19 +13,11 @@
|
||||||
|
|
||||||
namespace phpbb\profilefields;
|
namespace phpbb\profilefields;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom Profile Fields
|
* Custom Profile Fields
|
||||||
*/
|
*/
|
||||||
class manager
|
class manager
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Container interface
|
|
||||||
* @var ContainerInterface
|
|
||||||
*/
|
|
||||||
protected $container;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auth object
|
* Auth object
|
||||||
* @var \phpbb\auth\auth
|
* @var \phpbb\auth\auth
|
||||||
|
@ -38,6 +30,12 @@ class manager
|
||||||
*/
|
*/
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database tools object
|
||||||
|
* @var \phpbb\db\tools
|
||||||
|
*/
|
||||||
|
protected $db_tools;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event dispatcher object
|
* Event dispatcher object
|
||||||
* @var \phpbb\event\dispatcher_interface
|
* @var \phpbb\event\dispatcher_interface
|
||||||
|
@ -68,6 +66,12 @@ class manager
|
||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Config_text object
|
||||||
|
* @var \phpbb\config\db_text
|
||||||
|
*/
|
||||||
|
protected $config_text;
|
||||||
|
|
||||||
protected $fields_table;
|
protected $fields_table;
|
||||||
|
|
||||||
protected $fields_language_table;
|
protected $fields_language_table;
|
||||||
|
@ -76,42 +80,37 @@ class manager
|
||||||
|
|
||||||
protected $profile_cache = array();
|
protected $profile_cache = array();
|
||||||
|
|
||||||
protected $config_text;
|
|
||||||
|
|
||||||
protected $db_tools;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct
|
* Construct
|
||||||
*
|
*
|
||||||
* @param ContainerInterface $container A container
|
|
||||||
* @param \phpbb\auth\auth $auth Auth object
|
* @param \phpbb\auth\auth $auth Auth object
|
||||||
* @param \phpbb\db\driver\driver_interface $db Database object
|
* @param \phpbb\db\driver\driver_interface $db Database object
|
||||||
|
* @param \phpbb\db\tools $db_tools Database object
|
||||||
* @param \phpbb\event\dispatcher_interface $dispatcher Event dispatcher object
|
* @param \phpbb\event\dispatcher_interface $dispatcher Event dispatcher object
|
||||||
* @param \phpbb\request\request $request Request object
|
* @param \phpbb\request\request $request Request object
|
||||||
* @param \phpbb\template\template $template Template object
|
* @param \phpbb\template\template $template Template object
|
||||||
* @param \phpbb\di\service_collection $type_collection
|
* @param \phpbb\di\service_collection $type_collection
|
||||||
* @param \phpbb\user $user User object
|
* @param \phpbb\user $user User object
|
||||||
|
* @param \phpbb\config\db_text $config_text Config_text object
|
||||||
* @param string $fields_table
|
* @param string $fields_table
|
||||||
* @param string $fields_language_table
|
* @param string $fields_language_table
|
||||||
* @param string $fields_data_table
|
* @param string $fields_data_table
|
||||||
*/
|
*/
|
||||||
public function __construct(ContainerInterface $container, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\di\service_collection $type_collection, \phpbb\user $user, $fields_table, $fields_language_table, $fields_data_table)
|
public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools $db_tools, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\di\service_collection $type_collection, \phpbb\user $user, \phpbb\config\db_text $config_text, $fields_table, $fields_language_table, $fields_data_table)
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
$this->db_tools = $db_tools;
|
||||||
$this->dispatcher = $dispatcher;
|
$this->dispatcher = $dispatcher;
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
$this->type_collection = $type_collection;
|
$this->type_collection = $type_collection;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
$this->config_text = $config_text;
|
||||||
|
|
||||||
$this->fields_table = $fields_table;
|
$this->fields_table = $fields_table;
|
||||||
$this->fields_language_table = $fields_language_table;
|
$this->fields_language_table = $fields_language_table;
|
||||||
$this->fields_data_table = $fields_data_table;
|
$this->fields_data_table = $fields_data_table;
|
||||||
|
|
||||||
$this->config_text = $this->container->get('config_text');
|
|
||||||
$this->db_tools = $this->container->get('dbal.tools');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue