Commit 459431e8 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Gerrit Code Review
Browse files

Merge changes I9366f8fe,I73fb2777

* changes:
  Bug 1796044: making 'group' alias in quotes
  Bug 1795597: Install/upgrade LTI tables for mysql
parents 9aa65999 5841556e
......@@ -7,7 +7,7 @@
<TABLE NAME="lti_assessment">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
<FIELD NAME="oauthserver" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="oauthserver" TYPE="int" LENGTH="10" UNSIGNED="true" SEQUENCE="false" NOTNULL="true" />
<FIELD NAME="resourcelinkid" TYPE="text" NOTNULL="true" />
<FIELD NAME="contextid" TYPE="text" NOTNULL="true" />
<FIELD NAME="lisoutcomeserviceurl" TYPE="text" NOTNULL="true" />
......@@ -24,10 +24,6 @@
<KEY NAME="oauthserverregistryfk" TYPE="foreign" FIELDS="oauthserver" REFTABLE="oauth_server_registry" REFFIELDS="id" />
<KEY NAME="groupfk" TYPE="foreign" FIELDS="group" REFTABLE="group" REFFIELDS="id" />
</KEYS>
<INDEXES>
<INDEX NAME="resourcelinkididx" UNIQUE="false" FIELDS="resourcelinkid" />
<INDEX NAME="contextididx" UNIQUE="false" FIELDS="contextid" />
</INDEXES>
</TABLE>
<TABLE NAME="lti_assessment_submission">
<FIELDS>
......@@ -49,9 +45,6 @@
<KEY NAME="viewfk" TYPE="foreign" FIELDS="viewid" REFTABLE="view" REFFIELDS="id" />
<KEY NAME="ltiassessmentfk" TYPE="foreign" FIELDS="ltiassessment" REFTABLE="lti_assessment" REFFIELDS="id" />
</KEYS>
<INDEXES>
<INDEX NAME="lisresultsourceididx" UNIQUE="false" FIELDS="lisresultsourceid" />
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
......@@ -22,7 +22,7 @@ function xmldb_module_lti_upgrade($oldversion=0) {
$table = new XMLDBTable('lti_assessment');
$table->addFieldInfo('id', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, XMLDB_SEQUENCE);
$table->addFieldInfo('oauthserver', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL);
$table->addFieldInfo('oauthserver', XMLDB_TYPE_INTEGER, 10, XMLDB_UNSIGNED, XMLDB_NOTNULL);
$table->addFieldInfo('resourcelinkid', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL);
$table->addFieldInfo('contextid', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL);
$table->addFieldInfo('lisoutcomeserviceurl', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL);
......@@ -38,9 +38,6 @@ function xmldb_module_lti_upgrade($oldversion=0) {
$table->addKeyInfo('oauthserverregistryfk', XMLDB_KEY_FOREIGN, array('oauthserver'), 'oauth_server_registry', array('id'));
$table->addKeyInfo('groupfk', XMLDB_KEY_FOREIGN, array('group'), 'group', array('id'));
$table->addIndexInfo('resourcelinkididx', XMLDB_INDEX_NOTUNIQUE, array('resourcelinkid'));
$table->addIndexInfo('contextididx', XMLDB_INDEX_NOTUNIQUE, array('contextid'));
create_table($table);
log_debug('Adding "lti_assessment_submission" table');
......@@ -63,8 +60,6 @@ function xmldb_module_lti_upgrade($oldversion=0) {
$table->addKeyInfo('ltiassessmentfk', XMLDB_KEY_FOREIGN, array('ltiassessment'), 'lti_assessment', array('id'));
$table->addKeyInfo('viewfk', XMLDB_KEY_FOREIGN, array('viewid'), 'view', array('id'));
$table->addIndexInfo('lisresultsourceididx', XMLDB_INDEX_NOTUNIQUE, array('lisresultsourceid'));
create_table($table);
}
......
......@@ -25,6 +25,31 @@ class PluginModuleLti extends PluginModule {
);
public static function postinst($fromversion) {
if ($fromversion < 2018100100) {
// Add indexes to the lit_assessment table on install
log_debug('Add indexes to lti_assessment table');
$mysqlsuffix = is_mysql() ? '(255)' : '';
$table = new XMLDBTable('lti_assessment');
$field = new XMLDBField('resourcelinkid');
if (field_exists($table, $field)) {
$index = new XMLDBIndex('resourcelinkididx');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('resourcelinkid' . $mysqlsuffix));
add_index($table, $index);
}
$field = new XMLDBField('contextid');
if (field_exists($table, $field)) {
$index = new XMLDBIndex('contextididx');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('contextid' . $mysqlsuffix));
add_index($table, $index);
}
$field = new XMLDBField('listresultsourceid');
if (field_exists($table, $field)) {
$index = new XMLDBIndex('lisresultsourceididx');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('lisresultsourceid' . $mysqlsuffix));
add_index($table, $index);
}
}
require_once(get_config('docroot') . 'webservice/lib.php');
external_reload_component('module/lti', false);
}
......
......@@ -1111,7 +1111,7 @@ class PluginSearchInternal extends PluginSearch {
WHERE c.owner = ? " . $collectionwhere . $collectionfilter . ")
UNION
(SELECT b.id, b.title, NULL AS description, 'blocktype' AS type, b.blocktype, NULL AS ctime,
NULL AS owner, NULL AS group, NULL AS institution, NULL AS urlid
NULL AS owner, NULL AS \"group\", NULL AS institution, NULL AS urlid
FROM {block_instance} b
JOIN {tag} bt ON (bt.resourcetype = 'blocktype' AND bt.resourceid = b.id" . $typecast . ") " . $blocktypejoin . "
WHERE bt.ownertype = 'user' AND bt.ownerid = ?" . $blocktypewhere . $blocktypefilter . ")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment