diff --git a/admin/cli/install.php b/admin/cli/install.php index 1d97e606cd0..0a5ce9be3f5 100644 --- a/admin/cli/install.php +++ b/admin/cli/install.php @@ -151,6 +151,7 @@ if (version_compare(phpversion(), "5.3.3") < 0) { } // set up configuration +global $CFG; $CFG = new stdClass(); $CFG->lang = 'en'; $CFG->dirroot = dirname(dirname(dirname(__FILE__))); @@ -200,6 +201,26 @@ if (defined('COMPONENT_CLASSLOADER')) { require($CFG->dirroot.'/version.php'); $CFG->target_release = $release; +$_SESSION = array(); +$_SESSION['SESSION'] = new stdClass(); +$_SESSION['SESSION']->lang = $CFG->lang; +$_SESSION['USER'] = new stdClass(); +$_SESSION['USER']->id = 0; +$_SESSION['USER']->mnethostid = 1; + +global $SESSION; +global $USER; +$SESSION = &$_SESSION['SESSION']; +$USER = &$_SESSION['USER']; + +global $COURSE; +$COURSE = new stdClass(); +$COURSE->id = 1; + +global $SITE; +$SITE = $COURSE; +define('SITEID', 1); + //Database types $databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'), 'mariadb'=> moodle_database::get_driver_instance('mariadb', 'native'), diff --git a/install.php b/install.php index c1c40ca6823..0c250a05f30 100644 --- a/install.php +++ b/install.php @@ -161,6 +161,7 @@ if (!empty($_POST)) { } // Fake some settings so that we can use selected functions from moodlelib.php, weblib.php and filelib.php. +global $CFG; $CFG = new stdClass(); $CFG->lang = $config->lang; $CFG->dirroot = dirname(__FILE__); @@ -232,17 +233,25 @@ if (defined('COMPONENT_CLASSLOADER')) { require('version.php'); $CFG->target_release = $release; -$SESSION = new stdClass(); -$SESSION->lang = $CFG->lang; +$_SESSION = array(); +$_SESSION['SESSION'] = new stdClass(); +$_SESSION['SESSION']->lang = $CFG->lang; +$_SESSION['USER'] = new stdClass(); +$_SESSION['USER']->id = 0; +$_SESSION['USER']->mnethostid = 1; -$USER = new stdClass(); -$USER->id = 0; +global $SESSION; +global $USER; +$SESSION = &$_SESSION['SESSION']; +$USER = &$_SESSION['USER']; +global $COURSE; $COURSE = new stdClass(); -$COURSE->id = 0; +$COURSE->id = 1; +global $SITE; $SITE = $COURSE; -define('SITEID', 0); +define('SITEID', 1); $hint_dataroot = ''; $hint_admindir = '';