37 lines
937 B
PHP
37 lines
937 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once dirname(__DIR__) . '/exec/lib/Settings.php';
|
|
|
|
function assert_true(bool $condition, string $message): void
|
|
{
|
|
if (!$condition) {
|
|
fwrite(STDERR, "FAIL: {$message}\n");
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
$tmp = tempnam(sys_get_temp_dir(), 'mysql-plugin-settings-');
|
|
if ($tmp === false) {
|
|
fwrite(STDERR, "FAIL: cannot create temporary settings file\n");
|
|
exit(1);
|
|
}
|
|
|
|
file_put_contents($tmp, <<<CONF
|
|
allow_remote_hosts=1
|
|
modify_server_configuration=0
|
|
MYSQL_PLUGIN_ALLOW_REMOTE_HOSTS=0
|
|
MYSQL_PLUGIN_MODIFY_SERVER_CONFIGURATION=0
|
|
CONF);
|
|
|
|
$settings = Settings::load($tmp);
|
|
@unlink($tmp);
|
|
|
|
assert_true($settings->allowRemoteHosts(), 'allow_remote_hosts=1 should enable remote hosts');
|
|
assert_true(
|
|
$settings->modifyServerConfiguration(),
|
|
'allow_remote_hosts=1 should enable server synchronization even when modify_server_configuration=0'
|
|
);
|
|
|
|
echo "settings_remote_hosts_test: OK\n";
|