MDL-17776 added new define CLI_SCRIPT that identifies all CLI scripts + cron (cli scripts do not have session and do not like HTML in output and are executed from command line, cron is an exception)

This commit is contained in:
skodak
2009-01-03 14:28:02 +00:00
parent e8b7114d5e
commit a91b910e4f
9 changed files with 42 additions and 31 deletions
+5 -2
View File
@@ -159,14 +159,17 @@ class moodle_session {
global $CFG, $nomoodlecookie;
if (!defined('NO_MOODLE_COOKIES')) {
if (isset($nomoodlecookie)) {
if (CLI_SCRIPT) {
// CLI scripts can not have session
define('NO_MOODLE_COOKIES', true);
} else if (isset($nomoodlecookie)) {
// backwards compatibility only
define('NO_MOODLE_COOKIES', $nomoodlecookie);
unset($nomoodlecookie);
} else {
define('NO_MOODLE_COOKIES', false);
}
}
unset($nomoodlecookie); // cleanup
if (!isset($CFG->cookiesecure) or strpos($CFG->wwwroot, 'https://') !== 0) {
$CFG->cookiesecure = 0;