mirror of
https://github.com/moodle/moodle.git
synced 2025-03-23 17:10:20 +01:00
Merge branch 'MDL-72236-master' of https://github.com/inkjet2000/moodle
This commit is contained in:
commit
8f78381d12
@ -162,9 +162,10 @@
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="userid-forumid" UNIQUE="false" FIELDS="userid, forumid"/>
|
||||
<INDEX NAME="userid-discussionid" UNIQUE="false" FIELDS="userid, discussionid"/>
|
||||
<INDEX NAME="forumid-userid" UNIQUE="false" FIELDS="forumid, userid"/>
|
||||
<INDEX NAME="discussionid-userid" UNIQUE="false" FIELDS="discussionid, userid"/>
|
||||
<INDEX NAME="postid-userid" UNIQUE="false" FIELDS="postid, userid"/>
|
||||
<INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
<TABLE NAME="forum_track_prefs" COMMENT="Tracks each users untracked forums">
|
||||
|
@ -284,5 +284,56 @@ function xmldb_forum_upgrade($oldversion) {
|
||||
upgrade_mod_savepoint(true, 2021101100, 'forum');
|
||||
}
|
||||
|
||||
if ($oldversion < 2021101101) {
|
||||
// Remove the userid-forumid index as it gets replaces with forumid-userid.
|
||||
$table = new xmldb_table('forum_read');
|
||||
$index = new xmldb_index('userid-forumid', XMLDB_INDEX_NOTUNIQUE, ['userid', 'forumid']);
|
||||
|
||||
// Conditionally launch drop index userid-forumid.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Remove the userid-discussionid index as it gets replaced with discussionid-userid.
|
||||
$table = new xmldb_table('forum_read');
|
||||
$index = new xmldb_index('userid-discussionid', XMLDB_INDEX_NOTUNIQUE, ['userid', 'discussionid']);
|
||||
|
||||
// Conditionally launch drop index userid-discussionid.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index userid (not unique) to be added to forum_read.
|
||||
$table = new xmldb_table('forum_read');
|
||||
$index = new xmldb_index('userid', XMLDB_INDEX_NOTUNIQUE, ['userid']);
|
||||
|
||||
// Conditionally launch add index userid.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Build replacement indexes to replace the two dropped earlier.
|
||||
// Define index forumid-userid (not unique) to be added to forum_read.
|
||||
$table = new xmldb_table('forum_read');
|
||||
$index = new xmldb_index('forumid-userid', XMLDB_INDEX_NOTUNIQUE, ['forumid', 'userid']);
|
||||
|
||||
// Conditionally launch add index forumid-userid.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index discussionid-userid (not unique) to be added to forum_read.
|
||||
$table = new xmldb_table('forum_read');
|
||||
$index = new xmldb_index('discussionid-userid', XMLDB_INDEX_NOTUNIQUE, ['discussionid', 'userid']);
|
||||
|
||||
// Conditionally launch add index discussionid-userid.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Forum savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2021101101, 'forum');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2021101100; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2021101101; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2021052500; // Requires this Moodle version.
|
||||
$plugin->component = 'mod_forum'; // Full name of the plugin (used for diagnostics)
|
||||
|
Loading…
x
Reference in New Issue
Block a user