Commit e5e7b38c authored by Aaron Wells's avatar Aaron Wells Committed by Robert Lyon

Bug 1588613: Later session start so we can use DB config table

The session init code relies on $CFG->session_timeout, which is
normally defined in the config table. So, we need to start the
session after opening the database connection.

(In the event that there's an earlier session start, for instance
due to an error message, this will cause the session for that
page load to disregard any database config values. But that's not
a show-stopper, and there's no easy way to fix it.)

Change-Id: Iffbeebc8e92929970a558ff0fbc726719bb92741
behatnotneeded: Covered by existing tests
(cherry picked from commit 12cb73cf)
parent a989b7af
......@@ -109,10 +109,6 @@ if (file_exists($locallib)) {
require($locallib);
}
// Start up a session object, in case we need to use it to print messages
require_once('auth/session.php');
$SESSION = Session::singleton();
// Database access functions
require('adodb/adodb-exceptions.inc.php');
require('adodb/adodb.inc.php');
......@@ -194,6 +190,11 @@ catch (SQLException $e) {
db_ignore_sql_exceptions(false);
}
// Start up a session object, in case we need to use it to print messages
require_once('auth/session.php');
$SESSION = Session::singleton();
// Make sure wwwroot is set and available, either in the database or in the
// config file. Cron requires it when sending out forums emails.
if (!isset($CFG->wwwroot) && isset($_SERVER['HTTP_HOST'])) {
......
Markdown is supported
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