Skip to content

Commit

Permalink
MDL-62588 enrol_paypal: Add missing instanceid field
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies committed Jun 18, 2018
1 parent 180988c commit f3323c2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion enrol/paypal/db/upgrade.php
Expand Up @@ -43,7 +43,9 @@
defined('MOODLE_INTERNAL') || die();

function xmldb_enrol_paypal_upgrade($oldversion) {
global $CFG;
global $DB;

$dbman = $DB->get_manager();

// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
Expand All @@ -57,5 +59,21 @@ function xmldb_enrol_paypal_upgrade($oldversion) {
// Automatically generated Moodle v3.5.0 release upgrade line.
// Put any upgrade step following this.

if ($oldversion < 2018051401) {

// Define field instanceid to be added to enrol_paypal.
// For some reason, some Moodle instances that are upgraded from old versions do not have this field.
$table = new xmldb_table('enrol_paypal');
$field = new xmldb_field('instanceid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'userid');

// Conditionally launch add field instanceid.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}

// Paypal savepoint reached.
upgrade_plugin_savepoint(true, 2018051401, 'enrol', 'paypal');
}

return true;
}
2 changes: 1 addition & 1 deletion enrol/paypal/version.php
Expand Up @@ -25,6 +25,6 @@

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

$plugin->version = 2018051400; // The current plugin version (Date: YYYYMMDDXX)
$plugin->version = 2018051401; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2018050800; // Requires this Moodle version
$plugin->component = 'enrol_paypal'; // Full name of the plugin (used for diagnostics)

0 comments on commit f3323c2

Please sign in to comment.