This commit is contained in:
Eloy Lafuente (stronk7) 2013-09-23 22:05:26 +02:00
commit fe64d4f7c8
2 changed files with 36 additions and 6 deletions

View File

@ -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'),

View File

@ -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 = '';