Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/enrol/database/db/install.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00026 defined('MOODLE_INTERNAL') || die();
00027 
00028 function xmldb_enrol_database_install() {
00029     global $CFG, $DB;
00030 
00031     // migrate old config settings first
00032     if (isset($CFG->enrol_dbtype)) {
00033         set_config('dbtype', $CFG->enrol_dbtype, 'enrol_database');
00034         unset_config('enrol_dbtype');
00035     }
00036     if (isset($CFG->enrol_dbhost)) {
00037         set_config('dbhost', $CFG->enrol_dbhost, 'enrol_database');
00038         unset_config('enrol_dbhost');
00039     }
00040     if (isset($CFG->enrol_dbuser)) {
00041         set_config('dbuser', $CFG->enrol_dbuser, 'enrol_database');
00042         unset_config('enrol_dbuser');
00043     }
00044     if (isset($CFG->enrol_dbpass)) {
00045         set_config('dbpass', $CFG->enrol_dbpass, 'enrol_database');
00046         unset_config('enrol_dbpass');
00047     }
00048     if (isset($CFG->enrol_dbname)) {
00049         set_config('dbname', $CFG->enrol_dbname, 'enrol_database');
00050         unset_config('enrol_dbname');
00051     }
00052     if (isset($CFG->enrol_dbtable)) {
00053         set_config('remoteenroltable', $CFG->enrol_dbtable, 'enrol_database');
00054         unset_config('enrol_dbtable');
00055     }
00056     if (isset($CFG->enrol_localcoursefield)) {
00057         set_config('localcoursefield', $CFG->enrol_localcoursefield, 'enrol_database');
00058         unset_config('enrol_localcoursefield');
00059     }
00060     if (isset($CFG->enrol_localuserfield)) {
00061         set_config('localuserfield', $CFG->enrol_localuserfield, 'enrol_database');
00062         unset_config('enrol_localuserfield');
00063     }
00064     if (isset($CFG->enrol_db_localrolefield)) {
00065         set_config('localrolefield', $CFG->enrol_db_localrolefield, 'enrol_database');
00066         unset_config('enrol_db_localrolefield');
00067     }
00068     if (isset($CFG->enrol_remotecoursefield)) {
00069         set_config('remotecoursefield', $CFG->enrol_remotecoursefield, 'enrol_database');
00070         unset_config('enrol_remotecoursefield');
00071     }
00072     if (isset($CFG->enrol_remoteuserfield)) {
00073         set_config('remoteuserfield', $CFG->enrol_remoteuserfield, 'enrol_database');
00074         unset_config('enrol_remoteuserfield');
00075     }
00076     if (isset($CFG->enrol_db_remoterolefield)) {
00077         set_config('remoterolefield', $CFG->enrol_db_remoterolefield, 'enrol_database');
00078         unset_config('enrol_db_remoterolefield');
00079     }
00080     if (isset($CFG->enrol_db_defaultcourseroleid)) {
00081         set_config('defaultrole', $CFG->enrol_db_defaultcourseroleid, 'enrol_database');
00082         unset_config('enrol_db_defaultcourseroleid');
00083     }
00084     unset_config('enrol_db_autocreate'); // replaced by new coruse temple sync
00085     if (isset($CFG->enrol_db_category)) {
00086         set_config('defaultcategory', $CFG->enrol_db_category, 'enrol_database');
00087         unset_config('enrol_db_category');
00088     }
00089     if (isset($CFG->enrol_db_template)) {
00090         set_config('templatecourse', $CFG->enrol_db_template, 'enrol_database');
00091         unset_config('enrol_db_template');
00092     }
00093     if (isset($CFG->enrol_db_ignorehiddencourse)) {
00094         set_config('ignorehiddencourses', $CFG->enrol_db_ignorehiddencourse, 'enrol_database');
00095         unset_config('enrol_db_ignorehiddencourse');
00096     }
00097 
00098     unset_config('enrol_db_disableunenrol');
00099 
00100 
00101 
00102 
00103 
00104 
00105     // just make sure there are no leftovers after disabled plugin
00106     if (!$DB->record_exists('enrol', array('enrol'=>'database'))) {
00107         role_unassign_all(array('component'=>'enrol_database'));
00108         return;
00109     }
00110 }
 All Data Structures Namespaces Files Functions Variables Enumerations