]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #5479 adds group full text index if missing
authorcash <cash.costello@gmail.com>
Fri, 17 May 2013 19:44:22 +0000 (15:44 -0400)
committercash <cash.costello@gmail.com>
Fri, 17 May 2013 19:44:22 +0000 (15:44 -0400)
engine/lib/upgrades/2013051700-1.8.15-add_missing_group_index-52a63a3a3ffaced2.php [new file with mode: 0644]
version.php

diff --git a/engine/lib/upgrades/2013051700-1.8.15-add_missing_group_index-52a63a3a3ffaced2.php b/engine/lib/upgrades/2013051700-1.8.15-add_missing_group_index-52a63a3a3ffaced2.php
new file mode 100644 (file)
index 0000000..ee99bdb
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Elgg 1.8.15 upgrade 2013051700
+ * add_missing_group_index
+ *
+ * Some Elgg sites are missing the groups_entity full text index on name and
+ * description. This checks if it exists and adds it if it does not.
+ */
+
+$db_prefix = elgg_get_config('dbprefix');
+
+$full_text_index_exists = false;
+$results = get_data("SHOW INDEX FROM {$db_prefix}groups_entity");
+if ($results) {
+       foreach ($results as $result) {
+               if ($result->Index_type === 'FULLTEXT') {
+                       $full_text_index_exists = true;
+               }
+       }
+}
+
+if ($full_text_index_exists == false) {
+       $query = "ALTER TABLE {$db_prefix}groups_entity 
+               ADD FULLTEXT name_2 (name, description)";
+       if (!update_data($query)) {
+               elgg_log("Failed to add full text index to groups_entity table", 'ERROR');
+       }
+}
index c5fc817d4137a093c4def44bbd02283ed03c3c12..ac554a94522bc6785aa985c3742626fcae1d2778 100644 (file)
@@ -11,7 +11,7 @@
 
 // YYYYMMDD = Elgg Date
 // XX = Interim incrementer
-$version = 2013030600;
+$version = 2013051700;
 
 // Human-friendly version name
 $release = '1.8.15';