|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 die;die;die; 00004 /* 00005 if (empty($CFG->unittestprefix)) { 00006 die; 00007 } 00008 00009 $CFG->xmlstrictheaders = false; 00010 00011 // extra security 00012 session_write_close(); 00013 00014 $return_url = "$CFG->wwwroot/$CFG->admin/tool/unittest/test_tables.php"; 00015 00016 // Temporarily override $DB and $CFG for a fresh install on the unit test prefix 00017 00018 $real_cfg = $CFG; 00019 00020 $CFG = new stdClass(); 00021 $CFG->dbhost = $real_cfg->dbhost; 00022 $CFG->dbtype = $real_cfg->dbtype; 00023 $CFG->dblibrary = $real_cfg->dblibrary; 00024 $CFG->dbuser = $real_cfg->dbuser; 00025 $CFG->dbpass = $real_cfg->dbpass; 00026 $CFG->dbname = $real_cfg->dbname; 00027 $CFG->unittestprefix = $real_cfg->unittestprefix; 00028 $CFG->wwwroot = $real_cfg->wwwroot; 00029 $CFG->dirroot = $real_cfg->dirroot; 00030 $CFG->libdir = $real_cfg->libdir; 00031 $CFG->dataroot = $real_cfg->dataroot; 00032 $CFG->admin = $real_cfg->admin; 00033 $CFG->release = $real_cfg->release; 00034 $CFG->version = $real_cfg->version; 00035 $CFG->config_php_settings = $real_cfg->config_php_settings; 00036 $CFG->debug = 0; 00037 00038 $DB = moodle_database::get_driver_instance($CFG->dbtype, $CFG->dblibrary); 00039 $DB->connect($CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->unittestprefix); 00040 00041 $test_tables = $DB->get_tables(); 00042 00043 include("$CFG->dirroot/version.php"); // defines $version and $release 00044 00046 if ($test_tables = $DB->get_tables() ) { // No tables yet at all. 00047 //TODO: make sure these are test tables & delte all these tables 00048 $manager = $DB->get_manager(); 00049 foreach ($test_tables as $table) { 00050 $xmldbtable = new xmldb_table($table); 00051 $manager->drop_table($xmldbtable); 00052 } 00053 } 00054 00056 00057 $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml"); 00058 00060 require_once("$CFG->libdir/db/install.php"); 00061 xmldb_main_install($version); 00062 00064 00065 // Install the roles system. 00066 moodle_install_roles(); 00067 00068 // Install core event handlers 00069 events_update_definition(); 00070 00071 // Install core message providers 00072 message_update_providers(); 00073 message_update_providers('message'); 00074 00075 // Write default settings unconditionally (i.e. even if a setting is already set, overwrite it) 00076 admin_apply_default_settings(NULL, true); 00077 00078 00080 $plugintypes = get_plugin_types(); 00081 foreach ($plugintypes as $type => $location) { 00082 upgrade_plugins($type); 00083 } 00084 00086 upgrade_finished(); 00087 00090 create_admin_user(); 00091 00092 00093 redirect('index.php'); 00094 */