Skip to content

Commit f601f8f

Browse files
author
David Monllao
committed
Merge branch 'MDL-62588-34' of git://github.com/rezaies/moodle into MOODLE_34_STABLE
2 parents 7090d80 + 5dcdf1d commit f601f8f

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

enrol/paypal/db/upgrade.php

+19-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
defined('MOODLE_INTERNAL') || die();
4444

4545
function xmldb_enrol_paypal_upgrade($oldversion) {
46-
global $CFG;
46+
global $DB;
47+
48+
$dbman = $DB->get_manager();
4749

4850
// Moodle v3.1.0 release upgrade line.
4951
// Put any upgrade step following this.
@@ -57,5 +59,21 @@ function xmldb_enrol_paypal_upgrade($oldversion) {
5759
// Automatically generated Moodle v3.4.0 release upgrade line.
5860
// Put any upgrade step following this.
5961

62+
if ($oldversion < 2017111301) {
63+
64+
// Define field instanceid to be added to enrol_paypal.
65+
// For some reason, some Moodle instances that are upgraded from old versions do not have this field.
66+
$table = new xmldb_table('enrol_paypal');
67+
$field = new xmldb_field('instanceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'userid');
68+
69+
// Conditionally launch add field instanceid.
70+
if (!$dbman->field_exists($table, $field)) {
71+
$dbman->add_field($table, $field);
72+
}
73+
74+
// Paypal savepoint reached.
75+
upgrade_plugin_savepoint(true, 2017111301, 'enrol', 'paypal');
76+
}
77+
6078
return true;
6179
}

enrol/paypal/version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
defined('MOODLE_INTERNAL') || die();
2727

28-
$plugin->version = 2017111300; // The current plugin version (Date: YYYYMMDDXX)
28+
$plugin->version = 2017111301; // The current plugin version (Date: YYYYMMDDXX)
2929
$plugin->requires = 2017110800; // Requires this Moodle version
3030
$plugin->component = 'enrol_paypal'; // Full name of the plugin (used for diagnostics)
3131
$plugin->cron = 60;

0 commit comments

Comments
 (0)