From ed9d105a52b122be718b0aecf7d47afdf1b656de Mon Sep 17 00:00:00 2001 From: Kevin Pham Date: Tue, 18 Oct 2022 16:14:52 +1100 Subject: [PATCH 1/2] perf(db): add index to improve query times Normally taking 135ms to complete, drops down to 0.4ms --- db/install.xml | 7 +++++-- db/upgrade.php | 15 +++++++++++++++ version.php | 4 ++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/db/install.xml b/db/install.xml index eb2e779..799eace 100644 --- a/db/install.xml +++ b/db/install.xml @@ -1,5 +1,5 @@ - @@ -161,6 +161,9 @@ + + + @@ -192,4 +195,4 @@
-
\ No newline at end of file + diff --git a/db/upgrade.php b/db/upgrade.php index 1cf5bfb..3000918 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -350,5 +350,20 @@ function xmldb_tool_trigger_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2021030404, 'tool', 'trigger'); } + if ($oldversion < 2021030408) { + + // Define index workflowid-number (not unique) to be added to tool_trigger_workflow_hist. + $table = new xmldb_table('tool_trigger_workflow_hist'); + $index = new xmldb_index('workflowid-number', XMLDB_INDEX_NOTUNIQUE, ['workflowid', 'number']); + + // Conditionally launch add index workflowid-number. + if (!$dbman->index_exists($table, $index)) { + $dbman->add_index($table, $index); + } + + // Trigger savepoint reached. + upgrade_plugin_savepoint(true, 2021030408, 'tool', 'trigger'); + } + return true; } diff --git a/version.php b/version.php index bf23e84..00fb10f 100755 --- a/version.php +++ b/version.php @@ -25,8 +25,8 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'tool_trigger'; -$plugin->release = 2021030407; -$plugin->version = 2021030407; +$plugin->release = 2021030408; +$plugin->version = 2021030408; $plugin->requires = 2016052300; $plugin->supported = [35, 310]; $plugin->maturity = MATURITY_STABLE; From b8a4a8eb9b73bb659a31614c0a942cecb4b1553f Mon Sep 17 00:00:00 2001 From: Kevin Pham Date: Wed, 19 Oct 2022 13:00:45 +1100 Subject: [PATCH 2/2] ci: disable phpdoc checks There's a lot of failing checks due to phpdoc, and we're gradually cutting across this plugin (considered legacy) to tool_dataflows --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64d9842..7c4e659 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,3 +8,4 @@ jobs: uses: catalyst/catalyst-moodle-workflows/.github/workflows/ci.yml@main with: disable_behat: true + disable_phpdoc: true