mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 21:38:54 +00:00
[ticket/15987] Go back to previous table definition type
This will still allow using the 'tables' parameter array but will also ensure full backward compatibility and compatibility with extensions that will add more tables to the 'tables' array. PHPBB3-15987
This commit is contained in:
parent
61fa4f006a
commit
d72498a9c3
7 changed files with 115 additions and 93 deletions
|
@ -1,79 +1,78 @@
|
||||||
parameters:
|
parameters:
|
||||||
tables:
|
tables.acl_groups: '%core.table_prefix%acl_groups'
|
||||||
acl_groups: '%core.table_prefix%acl_groups'
|
tables.acl_options: '%core.table_prefix%acl_options'
|
||||||
acl_options: '%core.table_prefix%acl_options'
|
tables.acl_roles: '%core.table_prefix%acl_roles'
|
||||||
acl_roles: '%core.table_prefix%acl_roles'
|
tables.acl_roles_data: '%core.table_prefix%acl_roles_data'
|
||||||
acl_roles_data: '%core.table_prefix%acl_roles_data'
|
tables.acl_users: '%core.table_prefix%acl_users'
|
||||||
acl_users: '%core.table_prefix%acl_users'
|
tables.attachments: '%core.table_prefix%attachments'
|
||||||
attachments: '%core.table_prefix%attachments'
|
tables.auth_provider_oauth_token_storage: '%core.table_prefix%oauth_tokens'
|
||||||
auth_provider_oauth_token_storage: '%core.table_prefix%oauth_tokens'
|
tables.auth_provider_oauth_states: '%core.table_prefix%oauth_states'
|
||||||
auth_provider_oauth_states: '%core.table_prefix%oauth_states'
|
tables.auth_provider_oauth_account_assoc: '%core.table_prefix%oauth_accounts'
|
||||||
auth_provider_oauth_account_assoc: '%core.table_prefix%oauth_accounts'
|
tables.banlist: '%core.table_prefix%banlist'
|
||||||
banlist: '%core.table_prefix%banlist'
|
tables.bbcodes: '%core.table_prefix%bbcodes'
|
||||||
bbcodes: '%core.table_prefix%bbcodes'
|
tables.bookmarks: '%core.table_prefix%bookmarks'
|
||||||
bookmarks: '%core.table_prefix%bookmarks'
|
tables.bots: '%core.table_prefix%bots'
|
||||||
bots: '%core.table_prefix%bots'
|
tables.captcha_qa_questions: '%core.table_prefix%captcha_questions'
|
||||||
captcha_qa_questions: '%core.table_prefix%captcha_questions'
|
tables.captcha_qa_answers: '%core.table_prefix%captcha_answers'
|
||||||
captcha_qa_answers: '%core.table_prefix%captcha_answers'
|
tables.captcha_qa_confirm: '%core.table_prefix%qa_confirm'
|
||||||
captcha_qa_confirm: '%core.table_prefix%qa_confirm'
|
tables.config: '%core.table_prefix%config'
|
||||||
config: '%core.table_prefix%config'
|
tables.config_text: '%core.table_prefix%config_text'
|
||||||
config_text: '%core.table_prefix%config_text'
|
tables.confirm: '%core.table_prefix%confirm'
|
||||||
confirm: '%core.table_prefix%confirm'
|
tables.disallow: '%core.table_prefix%disallow'
|
||||||
disallow: '%core.table_prefix%disallow'
|
tables.drafts: '%core.table_prefix%drafts'
|
||||||
drafts: '%core.table_prefix%drafts'
|
tables.ext: '%core.table_prefix%ext'
|
||||||
ext: '%core.table_prefix%ext'
|
tables.extensions: '%core.table_prefix%extensions'
|
||||||
extensions: '%core.table_prefix%extensions'
|
tables.extension_groups: '%core.table_prefix%extension_groups'
|
||||||
extension_groups: '%core.table_prefix%extension_groups'
|
tables.forums: '%core.table_prefix%forums'
|
||||||
forums: '%core.table_prefix%forums'
|
tables.forums_access: '%core.table_prefix%forums_access'
|
||||||
forums_access: '%core.table_prefix%forums_access'
|
tables.forums_track: '%core.table_prefix%forums_track'
|
||||||
forums_track: '%core.table_prefix%forums_track'
|
tables.forums_watch: '%core.table_prefix%forums_watch'
|
||||||
forums_watch: '%core.table_prefix%forums_watch'
|
tables.groups: '%core.table_prefix%groups'
|
||||||
groups: '%core.table_prefix%groups'
|
tables.icons: '%core.table_prefix%icons'
|
||||||
icons: '%core.table_prefix%icons'
|
tables.lang: '%core.table_prefix%lang'
|
||||||
lang: '%core.table_prefix%lang'
|
tables.log: '%core.table_prefix%log'
|
||||||
log: '%core.table_prefix%log'
|
tables.login_attempts: '%core.table_prefix%login_attempts'
|
||||||
login_attempts: '%core.table_prefix%login_attempts'
|
tables.migrations: '%core.table_prefix%migrations'
|
||||||
migrations: '%core.table_prefix%migrations'
|
tables.moderator_cache: '%core.table_prefix%moderator_cache'
|
||||||
moderator_cache: '%core.table_prefix%moderator_cache'
|
tables.modules: '%core.table_prefix%modules'
|
||||||
modules: '%core.table_prefix%modules'
|
tables.notification_types: '%core.table_prefix%notification_types'
|
||||||
notification_types: '%core.table_prefix%notification_types'
|
tables.notifications: '%core.table_prefix%notifications'
|
||||||
notifications: '%core.table_prefix%notifications'
|
tables.poll_options: '%core.table_prefix%poll_options'
|
||||||
poll_options: '%core.table_prefix%poll_options'
|
tables.poll_votes: '%core.table_prefix%poll_votes'
|
||||||
poll_votes: '%core.table_prefix%poll_votes'
|
tables.posts: '%core.table_prefix%posts'
|
||||||
posts: '%core.table_prefix%posts'
|
tables.privmsgs: '%core.table_prefix%privmsgs'
|
||||||
privmsgs: '%core.table_prefix%privmsgs'
|
tables.privmsgs_folder: '%core.table_prefix%privmsgs_folder'
|
||||||
privmsgs_folder: '%core.table_prefix%privmsgs_folder'
|
tables.privmsgs_rules: '%core.table_prefix%privmsgs_rules'
|
||||||
privmsgs_rules: '%core.table_prefix%privmsgs_rules'
|
tables.privmsgs_to: '%core.table_prefix%privmsgs_to'
|
||||||
privmsgs_to: '%core.table_prefix%privmsgs_to'
|
tables.profile_fields: '%core.table_prefix%profile_fields'
|
||||||
profile_fields: '%core.table_prefix%profile_fields'
|
tables.profile_fields_data: '%core.table_prefix%profile_fields_data'
|
||||||
profile_fields_data: '%core.table_prefix%profile_fields_data'
|
tables.profile_fields_options_language: '%core.table_prefix%profile_fields_lang'
|
||||||
profile_fields_options_language: '%core.table_prefix%profile_fields_lang'
|
tables.profile_fields_language: '%core.table_prefix%profile_lang'
|
||||||
profile_fields_language: '%core.table_prefix%profile_lang'
|
tables.ranks: '%core.table_prefix%ranks'
|
||||||
ranks: '%core.table_prefix%ranks'
|
tables.reports: '%core.table_prefix%reports'
|
||||||
reports: '%core.table_prefix%reports'
|
tables.reports_reasons: '%core.table_prefix%reports_reasons'
|
||||||
reports_reasons: '%core.table_prefix%reports_reasons'
|
tables.search_results: '%core.table_prefix%search_results'
|
||||||
search_results: '%core.table_prefix%search_results'
|
tables.search_wordlist: '%core.table_prefix%search_wordlist'
|
||||||
search_wordlist: '%core.table_prefix%search_wordlist'
|
tables.search_wordmatch: '%core.table_prefix%search_wordmatch'
|
||||||
search_wordmatch: '%core.table_prefix%search_wordmatch'
|
tables.sessions: '%core.table_prefix%sessions'
|
||||||
sessions: '%core.table_prefix%sessions'
|
tables.sessions_keys: '%core.table_prefix%sessions_keys'
|
||||||
sessions_keys: '%core.table_prefix%sessions_keys'
|
tables.sitelist: '%core.table_prefix%sitelist'
|
||||||
sitelist: '%core.table_prefix%sitelist'
|
tables.smilies: '%core.table_prefix%smilies'
|
||||||
smilies: '%core.table_prefix%smilies'
|
tables.sphinx: '%core.table_prefix%sphinx'
|
||||||
sphinx: '%core.table_prefix%sphinx'
|
tables.styles: '%core.table_prefix%styles'
|
||||||
styles: '%core.table_prefix%styles'
|
tables.styles_template: '%core.table_prefix%styles_template'
|
||||||
styles_template: '%core.table_prefix%styles_template'
|
tables.styles_template_data: '%core.table_prefix%styles_template_data'
|
||||||
styles_template_data: '%core.table_prefix%styles_template_data'
|
tables.styles_theme: '%core.table_prefix%styles_theme'
|
||||||
styles_theme: '%core.table_prefix%styles_theme'
|
tables.styles_imageset: '%core.table_prefix%styles_imageset'
|
||||||
styles_imageset: '%core.table_prefix%styles_imageset'
|
tables.styles_imageset_data: '%core.table_prefix%styles_imageset_data'
|
||||||
styles_imageset_data: '%core.table_prefix%styles_imageset_data'
|
tables.teampage: '%core.table_prefix%teampage'
|
||||||
teampage: '%core.table_prefix%teampage'
|
tables.topics: '%core.table_prefix%topics'
|
||||||
topics: '%core.table_prefix%topics'
|
tables.topics_posted: '%core.table_prefix%topics_posted'
|
||||||
topics_posted: '%core.table_prefix%topics_posted'
|
tables.topics_track: '%core.table_prefix%topics_track'
|
||||||
topics_track: '%core.table_prefix%topics_track'
|
tables.topics_watch: '%core.table_prefix%topics_watch'
|
||||||
topics_watch: '%core.table_prefix%topics_watch'
|
tables.user_group: '%core.table_prefix%user_group'
|
||||||
user_group: '%core.table_prefix%user_group'
|
tables.user_notifications: '%core.table_prefix%user_notifications'
|
||||||
user_notifications: '%core.table_prefix%user_notifications'
|
tables.users: '%core.table_prefix%users'
|
||||||
users: '%core.table_prefix%users'
|
tables.warnings: '%core.table_prefix%warnings'
|
||||||
warnings: '%core.table_prefix%warnings'
|
tables.words: '%core.table_prefix%words'
|
||||||
words: '%core.table_prefix%words'
|
tables.zebra: '%core.table_prefix%zebra'
|
||||||
zebra: '%core.table_prefix%zebra'
|
|
||||||
|
|
|
@ -160,7 +160,6 @@ class container_builder
|
||||||
{
|
{
|
||||||
$this->container_extensions = [
|
$this->container_extensions = [
|
||||||
new extension\core($this->get_config_path()),
|
new extension\core($this->get_config_path()),
|
||||||
new extension\tables(),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->use_extensions)
|
if ($this->use_extensions)
|
||||||
|
@ -168,6 +167,9 @@ class container_builder
|
||||||
$this->load_extensions();
|
$this->load_extensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add tables extension after all extensions
|
||||||
|
$this->container_extensions[] = new extension\tables();
|
||||||
|
|
||||||
// Inject the config
|
// Inject the config
|
||||||
if ($this->config_php_file)
|
if ($this->config_php_file)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,26 +22,27 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
class tables extends Extension
|
class tables extends Extension
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Loads a specific configuration.
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @param array $configs An array of configuration values
|
|
||||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
|
||||||
*
|
|
||||||
* @throws \InvalidArgumentException When provided tag is not defined in this extension
|
|
||||||
*/
|
*/
|
||||||
public function load(array $configs, ContainerBuilder $container)
|
public function load(array $configs, ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
if (!$container->hasParameter('tables'))
|
// Tables is a reserved parameter and will be overwritten at all times
|
||||||
|
$tables = [];
|
||||||
|
|
||||||
|
// Add access via 'tables' parameter to acquire array with all tables
|
||||||
|
$parameterBag = $container->getParameterBag();
|
||||||
|
$parameters = $parameterBag->all();
|
||||||
|
foreach ($parameters as $parameter_name => $parameter_value)
|
||||||
{
|
{
|
||||||
return;
|
if (!preg_match('/tables\.(.+)/', $parameter_name, $matches))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tables[$matches[1]] = $parameter_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tables = $container->getParameter('tables');
|
$container->setParameter('tables', $tables);
|
||||||
|
|
||||||
foreach ($tables as $table_name => $table_value)
|
|
||||||
{
|
|
||||||
$container->setParameter('tables.' . $table_name, $table_value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -77,6 +77,18 @@ namespace
|
||||||
$this->assertTrue($container->isFrozen());
|
$this->assertTrue($container->isFrozen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_tables_mapping()
|
||||||
|
{
|
||||||
|
$this->builder->without_cache();
|
||||||
|
$container = $this->builder->get_container();
|
||||||
|
$this->assertTrue($container->hasParameter('tables'));
|
||||||
|
$tables = $container->getParameter('tables');
|
||||||
|
$this->assertGreaterThan(0, count($tables));
|
||||||
|
$this->assertTrue($container->hasParameter('tables.foo_bar'));
|
||||||
|
$this->assertTrue(isset($tables['foo_bar']));
|
||||||
|
$this->assertEquals($tables['acl_groups'], 'phpbb_some_other');
|
||||||
|
}
|
||||||
|
|
||||||
public function test_without_cache()
|
public function test_without_cache()
|
||||||
{
|
{
|
||||||
$this->builder->without_cache();
|
$this->builder->without_cache();
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
parameters:
|
parameters:
|
||||||
core: true
|
core: true
|
||||||
|
tables.acl_groups: '%core.table_prefix%acl_groups'
|
||||||
|
tables.acl_options: '%core.table_prefix%acl_options'
|
||||||
|
tables.acl_roles: '%core.table_prefix%acl_roles'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
config.php:
|
config.php:
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
parameters:
|
parameters:
|
||||||
core: true
|
core: true
|
||||||
|
tables.acl_groups: '%core.table_prefix%acl_groups'
|
||||||
|
tables.acl_options: '%core.table_prefix%acl_options'
|
||||||
|
tables.acl_roles: '%core.table_prefix%acl_roles'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
config.php:
|
config.php:
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
parameters:
|
parameters:
|
||||||
enabled_4: true
|
enabled_4: true
|
||||||
|
tables.foo_bar: '%core.table_prefix%foo_bar'
|
||||||
|
tables.acl_groups: '%core.table_prefix%some_other'
|
||||||
|
|
Loading…
Add table
Reference in a new issue