Commit f93426cf authored by martinlanghoff's avatar martinlanghoff
Browse files

Merged from MOODLE_14_STABLE - Added option to respect php.ini session...

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.
parent be495e20
......@@ -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(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);
}
if (!file_exists($CFG->dataroot .'/sessions')) {
make_upload_directory('sessions');
}
ini_set('session.save_path', $CFG->dataroot .'/sessions');
if (!file_exists($CFG->dataroot .'/sessions')) {
make_upload_directory('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');
}
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 = '';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment