MDL-41592 general: Also checking the site path

This commit is contained in:
David Monllao
2013-12-02 14:18:10 +08:00
parent 7f7a91e4ce
commit 677b2e79f1
2 changed files with 12 additions and 9 deletions
+8 -8
View File
@@ -93,6 +93,14 @@ ini_set('log_errors', '1');
// Getting $CFG data.
require_once(__DIR__ . '/../../../../config.php');
// When we use the utilities we don't know how the site
// will be accessed, so if neither $CFG->behat_switchcompletely or
// $CFG->behat_wwwroot are set we must think that the site will
// be accessed using the built-in server which is set by default
// to localhost:8000. We need to do this to prevent uses of the production
// wwwroot when the site is being installed / dropped...
$CFG->behat_wwwroot = behat_get_wwwroot();
// Checking the integrity of the provided $CFG->behat_* vars
// to prevent conflicts with production and phpunit environments.
behat_check_config_vars();
@@ -125,14 +133,6 @@ if (!file_exists("$CFG->behat_dataroot/behattestdir.txt")) {
testing_initdataroot($CFG->behat_dataroot, 'behat');
}
// When we use the utilities we don't know how the site
// will be accessed, so if neither $CFG->behat_switchcompletely or
// $CFG->behat_wwwroot are set we must think that the site will
// be accessed using the built-in server which is set by default
// to localhost:8000. We need to do this to prevent uses of the production
// wwwroot when the site is being installed / dropped...
$CFG->behat_wwwroot = behat_get_wwwroot();
// Overrides vars with behat-test ones.
$vars = array('wwwroot', 'prefix', 'dataroot');
foreach ($vars as $var) {
+4 -1
View File
@@ -770,7 +770,10 @@ function initialise_fullme() {
// Do not abuse this to try to solve lan/wan access problems!!!!!
} else {
if (($rurl['host'] !== $wwwroot['host']) or (!empty($wwwroot['port']) and $rurl['port'] != $wwwroot['port'])) {
if (($rurl['host'] !== $wwwroot['host']) or
(!empty($wwwroot['port']) and $rurl['port'] != $wwwroot['port']) or
(strpos($rurl['path'], $wwwroot['path']) !== 0)) {
// Explain the problem and redirect them to the right URL
if (!defined('NO_MOODLE_COOKIES')) {
define('NO_MOODLE_COOKIES', true);