MDL-55825 enrol_lti: Added context type column to enrol_lti_lti2_context

This commit is contained in:
Jun Pataleta
2016-10-28 10:10:43 +08:00
parent a78d184c05
commit 826ee7370e
4 changed files with 20 additions and 1 deletions
+3
View File
@@ -343,6 +343,7 @@ class data_connector extends DataConnector {
$context->setRecordId($row->id);
$context->setConsumerId($row->consumerid);
$context->ltiContextId = $row->lticontextkey;
$context->type = $row->type;
$settings = unserialize($row->settings);
if (!is_array($settings)) {
$settings = array();
@@ -376,6 +377,7 @@ class data_connector extends DataConnector {
$params = [
'consumerid' => $consumerpk,
'lticontextkey' => $context->ltiContextId,
'type' => $context->type,
'settings' => $settingsvalue,
'created' => $context->created,
'updated' => $context->updated,
@@ -390,6 +392,7 @@ class data_connector extends DataConnector {
'id' => $id,
'contextid' => $consumerpk,
'lticontextkey' => $context->ltiContextId,
'type' => $context->type,
'settings' => $settingsvalue,
'updated' => $context->updated,
];
+1
View File
@@ -102,6 +102,7 @@
<FIELD NAME="id" TYPE="int" LENGTH="11" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="consumerid" TYPE="int" LENGTH="11" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="lticontextkey" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="type" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="settings" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="created" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="updated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
+15
View File
@@ -227,5 +227,20 @@ function xmldb_enrol_lti_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2016052303, 'enrol', 'lti');
}
if ($oldversion < 2016052304) {
// Define field type to be added to enrol_lti_lti2_context.
$table = new xmldb_table('enrol_lti_lti2_context');
$field = new xmldb_field('type', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'lticontextkey');
// Conditionally launch add field type.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Lti savepoint reached.
upgrade_plugin_savepoint(true, 2016052304, 'enrol', 'lti');
}
return true;
}
+1 -1
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016052303; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2016052304; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2016051900; // Requires this Moodle version (3.1)
$plugin->component = 'enrol_lti'; // Full name of the plugin (used for diagnostics).