Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/enrol/authorize/db/upgrade.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file keeps track of upgrades to
00004 // the authorize enrol plugin
00005 //
00006 // Sometimes, changes between versions involve
00007 // alterations to database structures and other
00008 // major things that may break installations.
00009 //
00010 // The upgrade function in this file will attempt
00011 // to perform all the necessary actions to upgrade
00012 // your older installation to the current version.
00013 //
00014 // If there's something it cannot do itself, it
00015 // will tell you what you need to do.
00016 //
00017 // The commands in here will all be database-neutral,
00018 // using the methods of database_manager class
00019 //
00020 // Please do not forget to use upgrade_set_timeout()
00021 // before any action that may take longer time to finish.
00022 
00023 function xmldb_enrol_authorize_upgrade($oldversion) {
00024     global $CFG, $DB, $OUTPUT;
00025 
00026     $dbman = $DB->get_manager();
00027 
00028     //===== 1.9.0 upgrade line ======//
00029 
00030     if ($oldversion < 2008092700) {
00033         $table = new xmldb_table('enrol_authorize');
00034         $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
00035         if ($dbman->index_exists($table, $index)) {
00036             $dbman->drop_index($table, $index);
00037         }
00038 
00040         $table = new xmldb_table('enrol_authorize');
00041         $field = new xmldb_field('transid', XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'userid');
00042         $dbman->change_field_precision($table, $field);
00043 
00045         $table = new xmldb_table('enrol_authorize');
00046         $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
00047         $dbman->add_index($table, $index);
00048 
00051         $table = new xmldb_table('enrol_authorize_refunds');
00052         $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
00053         if ($dbman->index_exists($table, $index)) {
00054             $dbman->drop_index($table, $index);
00055         }
00056 
00058         $table = new xmldb_table('enrol_authorize_refunds');
00059         $field = new xmldb_field('transid', XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, null, null, '0', 'amount');
00060         $dbman->change_field_precision($table, $field);
00061 
00063         $table = new xmldb_table('enrol_authorize_refunds');
00064         $index = new xmldb_index('transid', XMLDB_INDEX_NOTUNIQUE, array('transid'));
00065         $dbman->add_index($table, $index);
00066 
00068         upgrade_plugin_savepoint(true, 2008092700, 'enrol', 'authorize');
00069     }
00070 
00072     if ($oldversion < 2009042700) {
00073 
00075         $table = new xmldb_table('enrol_authorize');
00076         $field = new xmldb_field('paymentmethod', XMLDB_TYPE_CHAR, '6', null, XMLDB_NOTNULL, null, 'cc', 'id');
00077 
00079         $dbman->drop_enum_from_field($table, $field);
00080 
00082         upgrade_plugin_savepoint(true, 2009042700, 'enrol', 'authorize');
00083     }
00084 
00085     // Add instanceid field to enrol_authorize table
00086     if ($oldversion < 2010081203) {
00087         $table = new xmldb_table('enrol_authorize');
00088         $field = new xmldb_field('instanceid');
00089         if (!$dbman->field_exists($table, $field)) {
00090             $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0, 'userid');
00091             $dbman->add_field($table, $field);
00092         }
00093         upgrade_plugin_savepoint(true, 2010081203, 'enrol', 'authorize');
00094     }
00095 
00096     // Moodle v2.1.0 release upgrade line
00097     // Put any upgrade step following this
00098 
00099     // Moodle v2.2.0 release upgrade line
00100     // Put any upgrade step following this
00101 
00102     return true;
00103 }
 All Data Structures Namespaces Files Functions Variables Enumerations