Documentation for the request class is here. Try doing
Code: Select all
$server_script = htmlspecialchars_decode($request->server('SCRIPT_NAME'));
Hello.Kailey wrote: ↑Fri Nov 25, 2022 5:28 pmDocumentation for the request class is here. Try doing
Code: Select all
$server_script = htmlspecialchars_decode($request->server('SCRIPT_NAME'));
Code: Select all
$HTTP_HOST = $_SERVER['HTTP_HOST'];
if (strpos($HTTP_HOST, '-test') !== false) {
$dbname = 'something';
} elseif (strpos($HTTP_HOST, '-old') !== false) {
$dbname = 'something_else';
} else {
$dbname = 'something_else_again';
}
Code: Select all
{
"errors": [
{
"title": "<b>General Error:</b><br>Illegal use of $_SERVER. You must use the request class to access input data. Found in /srv/www/asperansa/forum/config.php on line 7. This error message was generated by deactivated_super_global.<br> in file /srv/www/asperansa/forum/phpbb/request/deactivated_super_global.php on line 67<br><br>"
}
],
"over": true
}
Code: Select all
global $request;
Excellent idea, thank you very much.Mike-on-Tour wrote: ↑Sat Apr 01, 2023 2:39 pm Have you tried to useto get the request class?Code: Select all
global $request;
Code: Select all
if (is_array($_SERVER)) {
$http_host = $_SERVER['HTTP_HOST'] ?? '';
} else {
global $request;
$http_host = $request->server('HTTP_HOST');
}
if (empty($http_host)) {
die('No way to access $_SERVER superglobal');
}
if (strpos($http_host, '-test') !== false) {
$dbname = 'something';
} elseif (strpos($http_host, '-old') !== false) {
$dbname = 'something_else';
} else {
$dbname = 'something_else_again';
}
I upgrade by manually replacing files (after applying my own patches), and I use the /install interface for upgrading the database.