mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-69779-better-x-redirect-by' of https://github.com/brendanheywood/moodle
This commit is contained in:
commit
df61149804
@ -55,6 +55,7 @@ information provided here is intended especially for developers.
|
||||
* A new admin externalpage type `\core_admin\local\externalpage\accesscallback` for use in plugin settings is available that allows
|
||||
a callback to be provided to determine whether page can be accessed.
|
||||
* New setting $CFG->localtempdir overrides which defaults to sys_get_temp_dir()
|
||||
* Function redirect() now emits a line of backtrace into the X-Redirect-By header when debugging is on
|
||||
|
||||
=== 3.9 ===
|
||||
* Following function has been deprecated, please use \core\task\manager::run_from_cli().
|
||||
|
@ -2954,9 +2954,17 @@ function redirect($url, $message='', $delay=null, $messagetype = \core\output\no
|
||||
\core\session\manager::write_close();
|
||||
|
||||
if ($delay == 0 && !$debugdisableredirect && !headers_sent()) {
|
||||
|
||||
// This helps when debugging redirect issues like loops and it is not clear
|
||||
// which layer in the stack sent the redirect header.
|
||||
@header('X-Redirect-By: Moodle');
|
||||
// which layer in the stack sent the redirect header. If debugging is on
|
||||
// then the file and line is also shown.
|
||||
$redirectby = 'Moodle';
|
||||
if (debugging('', DEBUG_DEVELOPER)) {
|
||||
$origin = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1)[0];
|
||||
$redirectby .= ' /' . str_replace($CFG->dirroot . '/', '', $origin['file']) . ':' . $origin['line'];
|
||||
}
|
||||
@header("X-Redirect-By: $redirectby");
|
||||
|
||||
// 302 might not work for POST requests, 303 is ignored by obsolete clients.
|
||||
@header($_SERVER['SERVER_PROTOCOL'] . ' 303 See Other');
|
||||
@header('Location: '.$url);
|
||||
|
Loading…
x
Reference in New Issue
Block a user