MDL-44106 add WS_SERVER constant to all web service calls
This will help us hack around some nasty webservice problems, such as require_login() and it will be used to set proper 'ws' origin in logged events.
This commit is contained in:
@@ -304,6 +304,11 @@ if (defined('WEB_CRON_EMULATED_CLI')) {
|
||||
}
|
||||
}
|
||||
|
||||
// All web service requests have WS_SERVER == true.
|
||||
if (!defined('WS_SERVER')) {
|
||||
define('WS_SERVER', false);
|
||||
}
|
||||
|
||||
// Detect CLI maintenance mode - this is useful when you need to mess with database, such as during upgrades
|
||||
if (file_exists("$CFG->dataroot/climaintenance.html")) {
|
||||
if (!CLI_SCRIPT) {
|
||||
@@ -745,6 +750,10 @@ if (CLI_SCRIPT) {
|
||||
// no sessions in CLI scripts possible
|
||||
define('NO_MOODLE_COOKIES', true);
|
||||
|
||||
} else if (WS_SERVER) {
|
||||
// No sessions possible in web services.
|
||||
define('NO_MOODLE_COOKIES', true);
|
||||
|
||||
} else if (!defined('NO_MOODLE_COOKIES')) {
|
||||
if (empty($CFG->version) or $CFG->version < 2009011900) {
|
||||
// no session before sessions table gets created
|
||||
|
||||
Reference in New Issue
Block a user