From cef1ea8e8e7b3b48379f4ea91ab44449fc767dd8 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Mon, 8 Oct 2007 16:33:29 +0000 Subject: [PATCH] Adding one new index to cache_text table. User to make cron deletion of expired records faster. MDL-11605 --- lib/db/install.xml | 3 ++- lib/db/upgrade.php | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/db/install.xml b/lib/db/install.xml index 910cbae4a2..1a8241306b 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -264,7 +264,8 @@ - + + diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index e68fc4dce9..63b94b9892 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2400,6 +2400,21 @@ function xmldb_main_upgrade($oldversion=0) { $result = $result && drop_table($table); } +/// Truncate the text_cahe table and add new index + if ($result && $oldversion < 2007100802) { + + /// Truncate the cache_text table + execute_sql("TRUNCATE TABLE {$CFG->prefix}cache_text", true); + + /// Define index timemodified (not unique) to be added to cache_text + $table = new XMLDBTable('cache_text'); + $index = new XMLDBIndex('timemodified'); + $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('timemodified')); + + /// Launch add index timemodified + $result = $result && add_index($table, $index); + } + return $result; } -- 2.39.5