Added check for <text> fields that contain markup (an error!)
[moodle-linuxchix.git] / enrol / authorize / db / upgrade.php
blobc28da08f87543086f24d871bc8ddb4be17309815
1 <?php //$Id$
3 // This file keeps track of upgrades to
4 // the authorize enrol plugin
5 //
6 // Sometimes, changes between versions involve
7 // alterations to database structures and other
8 // major things that may break installations.
9 //
10 // The upgrade function in this file will attempt
11 // to perform all the necessary actions to upgrade
12 // your older installtion to the current version.
14 // If there's something it cannot do itself, it
15 // will tell you what you need to do.
17 // The commands in here will all be database-neutral,
18 // using the functions defined in lib/ddllib.php
20 function xmldb_enrol_authorize_upgrade($oldversion=0) {
22 global $CFG, $THEME, $db;
24 $result = true;
26 if ($result && $oldversion < 2006111700) {
27 $table = new XMLDBTable('enrol_authorize');
28 if (!field_exists($table, new XMLDBField('refundinfo'))) {
29 $field = new XMLDBField('cclastfour');
30 $field->setAttributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'paymentmethod');
31 $result = $result && rename_field($table, $field, 'refundinfo');
35 if ($result && $oldversion < 2006112900) {
36 if (isset($CFG->an_login)) {
37 if (empty($CFG->an_login)) {
38 unset_config('an_login');
40 else {
41 $result = $result && set_config('an_login', rc4encrypt($CFG->an_login), 'enrol/authorize') && unset_config('an_login');
44 if (isset($CFG->an_tran_key)) {
45 if (empty($CFG->an_tran_key)) {
46 unset_config('an_tran_key');
48 else {
49 $result = $result && set_config('an_tran_key', rc4encrypt($CFG->an_tran_key), 'enrol/authorize') && unset_config('an_tran_key');
52 if (isset($CFG->an_password)) {
53 if (empty($CFG->an_password)) {
54 unset_config('an_password');
56 else {
57 $result = $result && set_config('an_password', rc4encrypt($CFG->an_password), 'enrol/authorize') && unset_config('an_password');
62 return $result;