mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 20:53:53 +01:00
MDL-53795 logging: Add DB index for use when backing up logs
This commit is contained in:
parent
b611ade3ab
commit
e214f22f39
@ -30,6 +30,7 @@
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
<KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="timecreated" UNIQUE="false" FIELDS="timecreated"/>
|
||||
|
@ -25,7 +25,9 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_logstore_standard_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
@ -36,5 +38,20 @@ function xmldb_logstore_standard_upgrade($oldversion) {
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016041200) {
|
||||
// This could take a long time. Unfortunately, no way to know how long, and no way to do progress, so setting for 1 hour.
|
||||
upgrade_set_timeout(3600);
|
||||
|
||||
// Define key contextid (foreign) to be added to logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
$key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
|
||||
|
||||
// Launch add key contextid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Standard savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2016041200, 'logstore', 'standard');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2016041200; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version.
|
||||
$plugin->component = 'logstore_standard'; // Full name of the plugin (used for diagnostics).
|
||||
|
Loading…
x
Reference in New Issue
Block a user