mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
Merged from MOODLE_14_STABLE - Added option to respect php.ini session settings, else we reenable garbage collection for sessions. Fixes stale session problems with Debian systems, but still allows package maintainers to override.
This commit is contained in:
parent
be495e2097
commit
f93426cf07
@ -204,8 +204,14 @@ $CFG->defaultblocks = 'participants,activity_modules,search_forums,admin,course_
|
||||
// The next lines are needed both for bounce handling and any other email to module processing.
|
||||
// mailprefix must be EXACTLY four characters.
|
||||
// Uncomment and customise this block for Postfix
|
||||
//$CFG->mailprefix = 'mdl+'; // + is postfix default separator.
|
||||
//$CFG->mailprefix = 'mdl+'; // + is the separator for Exim and Postfix.
|
||||
//$CFG->mailprefix = 'mdl-'l // - is the separator for qmail
|
||||
//$CFG->maildomain = 'youremaildomain.com';
|
||||
//
|
||||
// The following setting will tell Moodle to respect your PHP session
|
||||
// settings. Use this if you want to control session configuration
|
||||
// from php.ini, httpd.conf or .htaccess files.
|
||||
// $CFG->respectsessionsettings = true;
|
||||
|
||||
//=========================================================================
|
||||
// ALL DONE! To continue installation, visit your main page with a browser
|
||||
|
@ -172,29 +172,38 @@ global $THEME;
|
||||
//$smarty->compile_dir = $CFG->dataroot .'/cache';
|
||||
|
||||
/// Set up session handling
|
||||
if (empty($CFG->dbsessions)) { /// File-based sessions
|
||||
if (!empty($CFG->sessiontimeout)) {
|
||||
ini_set('session.gc_maxlifetime', $CFG->sessiontimeout);
|
||||
}
|
||||
|
||||
if (!file_exists($CFG->dataroot .'/sessions')) {
|
||||
make_upload_directory('sessions');
|
||||
}
|
||||
ini_set('session.save_path', $CFG->dataroot .'/sessions');
|
||||
|
||||
} else { /// Database sessions
|
||||
ini_set('session.save_handler', 'user');
|
||||
|
||||
$ADODB_SESSION_DRIVER = $CFG->dbtype;
|
||||
$ADODB_SESSION_CONNECT = $CFG->dbhost;
|
||||
$ADODB_SESSION_USER = $CFG->dbuser;
|
||||
$ADODB_SESSION_PWD = $CFG->dbpass;
|
||||
$ADODB_SESSION_DB = $CFG->dbname;
|
||||
$ADODB_SESSION_TBL = $CFG->prefix.'sessions';
|
||||
if(empty($CFG->respectsessionsettings)) {
|
||||
if (empty($CFG->dbsessions)) { /// File-based sessions
|
||||
|
||||
// Some distros disable GC by setting probability to 0
|
||||
// overriding the PHP default of 1
|
||||
// (gc_probability is divided by gc_divisor, which defaults to 1000)
|
||||
if (ini_get('session.gc_probability') == 0) {
|
||||
ini_set('session.gc_probability', 1);
|
||||
}
|
||||
|
||||
if (!empty($CFG->sessiontimeout)) {
|
||||
ini_set('session.gc_maxlifetime', $CFG->sessiontimeout);
|
||||
}
|
||||
|
||||
require_once($CFG->libdir. '/adodb/session/adodb-session.php');
|
||||
if (!file_exists($CFG->dataroot .'/sessions')) {
|
||||
make_upload_directory('sessions');
|
||||
}
|
||||
ini_set('session.save_path', $CFG->dataroot .'/sessions');
|
||||
|
||||
} else { /// Database sessions
|
||||
ini_set('session.save_handler', 'user');
|
||||
|
||||
$ADODB_SESSION_DRIVER = $CFG->dbtype;
|
||||
$ADODB_SESSION_CONNECT = $CFG->dbhost;
|
||||
$ADODB_SESSION_USER = $CFG->dbuser;
|
||||
$ADODB_SESSION_PWD = $CFG->dbpass;
|
||||
$ADODB_SESSION_DB = $CFG->dbname;
|
||||
$ADODB_SESSION_TBL = $CFG->prefix.'sessions';
|
||||
|
||||
require_once($CFG->libdir. '/adodb/session/adodb-session.php');
|
||||
}
|
||||
}
|
||||
|
||||
/// Set sessioncookie variable if it isn't already
|
||||
if (!isset($CFG->sessioncookie)) {
|
||||
$CFG->sessioncookie = '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user