1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-21 08:00:46 +01:00

Merge branch '3.3.x'

This commit is contained in:
Marc Alexander 2020-06-07 11:22:00 +02:00
commit 0656c0d6dd
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
5 changed files with 217 additions and 1 deletions

View File

@ -95,13 +95,14 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('database_gc', '604800');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('dbms_version', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_dateformat', 'D M d, Y g:i a');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_search_return_chars', '300');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_style', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_edited', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_subject', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_order', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_unapproved_posts', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('default_search_return_chars', '300');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_force_sender', '0');
@ -255,6 +256,15 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_trigger_post
INSERT INTO phpbb_config (config_name, config_value) VALUES ('ranks_path', 'images/ranks');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('read_notification_expire_days', '30');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('read_notification_gc', '86400');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('recaptcha_v3_domain', 'google.com');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('recaptcha_v3_key', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('recaptcha_v3_method', 'post');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('recaptcha_v3_secret', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('recaptcha_v3_threshold_default', '0.5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('recaptcha_v3_threshold_login', '0.5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('recaptcha_v3_threshold_post', '0.5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('recaptcha_v3_threshold_register', '0.5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('recaptcha_v3_threshold_report', '0.5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('referer_validation', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('remote_upload_verify', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation', '0');

View File

@ -0,0 +1,33 @@
# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from
# module mod_authz_host to a new module called mod_access_compat (which may be
# disabled) and a new "Require" syntax has been introduced to mod_authz_host.
# We could just conditionally provide both versions, but unfortunately Apache
# does not explicitly tell us its version if the module mod_version is not
# available. In this case, we check for the availability of module
# mod_authz_core (which should be on 2.4 or higher only) as a best guess.
<IfModule mod_version.c>
<IfVersion < 2.4>
<Files "*">
Order Allow,Deny
Deny from All
</Files>
</IfVersion>
<IfVersion >= 2.4>
<Files "*">
Require all denied
</Files>
</IfVersion>
</IfModule>
<IfModule !mod_version.c>
<IfModule !mod_authz_core.c>
<Files "*">
Order Allow,Deny
Deny from All
</Files>
</IfModule>
<IfModule mod_authz_core.c>
<Files "*">
Require all denied
</Files>
</IfModule>
</IfModule>

View File

@ -0,0 +1,33 @@
# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from
# module mod_authz_host to a new module called mod_access_compat (which may be
# disabled) and a new "Require" syntax has been introduced to mod_authz_host.
# We could just conditionally provide both versions, but unfortunately Apache
# does not explicitly tell us its version if the module mod_version is not
# available. In this case, we check for the availability of module
# mod_authz_core (which should be on 2.4 or higher only) as a best guess.
<IfModule mod_version.c>
<IfVersion < 2.4>
<Files "*">
Order Allow,Deny
Deny from All
</Files>
</IfVersion>
<IfVersion >= 2.4>
<Files "*">
Require all denied
</Files>
</IfVersion>
</IfModule>
<IfModule !mod_version.c>
<IfModule !mod_authz_core.c>
<Files "*">
Order Allow,Deny
Deny from All
</Files>
</IfModule>
<IfModule mod_authz_core.c>
<Files "*">
Require all denied
</Files>
</IfModule>
</IfModule>

View File

@ -63,6 +63,13 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
$crawler = self::submit($form);
self::assertContainsLang('CONFIG_UPDATED', $crawler->filter('.successbox')->text());
// Disable showing unapproved posts to users
$crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=acp_board&mode=features");
$form = $crawler->selectButton('Submit')->form();
$form->setValues(['config[display_unapproved_posts]' => false]);
$crawler = self::submit($form);
self::assertContainsLang('CONFIG_UPDATED', $crawler->filter('.successbox')->text());
// Special config (Guest can't see attachments)
$this->add_lang('acp/permissions');

View File

@ -0,0 +1,133 @@
<?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.
*
*/
class migrations_check_config_added_test extends phpbb_test_case
{
public function setUp(): void
{
global $phpbb_root_path;
// Get schema data from file
$this->schema_data = file_get_contents($phpbb_root_path . 'install/schemas/schema_data.sql');
}
public function get_config_options_from_migrations()
{
global $phpbb_root_path, $phpEx;
$this->config = new \phpbb\config\config([
'search_type' => '\phpbb\search\fulltext_mysql',
]);
$this->db = $this->createMock('\phpbb\db\driver\driver_interface');
$factory = new \phpbb\db\tools\factory();
$this->db_tools = $factory->get($this->db);
$this->table_prefix = 'phpbb_';
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
$this->container = new phpbb_mock_container_builder();
$this->migrator = new \phpbb\db\migrator(
$this->container,
$this->config,
$this->db,
$this->db_tools,
'phpbb_migrations',
$this->phpbb_root_path,
$this->php_ext,
$this->table_prefix,
[],
new \phpbb\db\migration\helper()
);
$this->container->set('migrator', $this->migrator);
$this->extension_manager = new phpbb_mock_extension_manager(
$this->phpbb_root_path,
[],
$this->container
);
// Get all migrations
$migrations = $this->extension_manager
->get_finder()
->core_path('phpbb/db/migration/data/')
->extension_directory('/migrations')
->get_classes();
$config_names = $config_removed = [];
foreach ($migrations as $key => $class)
{
// Filter non-migration files
if (!$this->migrator::is_migration($class))
{
unset($migrations[$key]);
continue;
}
// Create migration object instance
$migration = $this->migrator->get_migration($class);
// $step[0] - action (config.*|if|custom|etc), $step[1][1] - action when wrapped with 'if' action
// $step[1] - action parameters for non-'if'-wrapped actions (0 => config_name and 1 => config_value)
// $step[1][0] - configuration option to add/update/remove (config_name)
foreach ($migration->update_data() as $migration_name => $step)
{
if ($step[0] == 'if')
{
$step = $step[1][1];
}
// Filter out actions different from config.*
if ($step[0] == 'custom' || strpos($step[0], 'config') === false)
{
continue;
}
$config_name = $step[1][0];
// Exclude removed configuration options and filter them out
if ($step[0] == 'config.remove')
{
if (!isset($config_removed[$config_name]))
{
$config_removed[$config_name] = true;
}
continue;
}
// Fill error entries for configuration options which were not added to shema_data.sql
if (!isset($config_names[$config_name]))
{
$config_names[$config_name] = [$config_name, $class];
}
}
}
// Drop configuration options which were removed by config.remove
$config_names = array_diff_key($config_names, $config_removed);
return $config_names;
}
/**
* @dataProvider get_config_options_from_migrations
*/
public function test_config_option_exists_in_schema_data($config_name, $class)
{
$message = 'Migration: %1$s, config_name: %2$s; not added to shema_data.sql';
$this->assertNotFalse(strpos($this->schema_data, $config_name),
sprintf($message, $class, $config_name)
);
}
}