From e9024a144395a0375f44816f7e4d4677a03ee505 Mon Sep 17 00:00:00 2001 From: Eric Merrill Date: Tue, 12 Apr 2016 22:26:35 -0400 Subject: [PATCH] MDL-53795 logging: Add DB index for use when backing up logs --- admin/tool/log/store/standard/db/install.xml | 1 + admin/tool/log/store/standard/db/upgrade.php | 15 +++++++++++++++ admin/tool/log/store/standard/version.php | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/admin/tool/log/store/standard/db/install.xml b/admin/tool/log/store/standard/db/install.xml index 9586c034b66..22d80d4e06e 100644 --- a/admin/tool/log/store/standard/db/install.xml +++ b/admin/tool/log/store/standard/db/install.xml @@ -30,6 +30,7 @@ + diff --git a/admin/tool/log/store/standard/db/upgrade.php b/admin/tool/log/store/standard/db/upgrade.php index 9b4247b9a4a..fc3b1bfcb12 100644 --- a/admin/tool/log/store/standard/db/upgrade.php +++ b/admin/tool/log/store/standard/db/upgrade.php @@ -123,5 +123,20 @@ function xmldb_logstore_standard_upgrade($oldversion) { // Moodle v3.0.0 release upgrade line. // Put any upgrade step following this. + if ($oldversion < 2015111601) { + // 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, 2015111601, 'logstore', 'standard'); + } + return true; } diff --git a/admin/tool/log/store/standard/version.php b/admin/tool/log/store/standard/version.php index 73c131e551e..e5cdc97a3a2 100644 --- a/admin/tool/log/store/standard/version.php +++ b/admin/tool/log/store/standard/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2015111601; // 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).