summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-10-17 12:53:35 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-10-17 12:53:35 (GMT)
commitf3332f9ffb376c7eec51f6b4a9819f5e5d8199b1 (patch)
tree02b894fbe14af4c57d182b554edaa09dd490b8c2
parent061def18a1460e9646d3a5a42ff3bf062964dce8 (diff)
downloadroundcubemail-plugins-kolab-f3332f9ffb376c7eec51f6b4a9819f5e5d8199b1.tar.gz
Cache relation members for better performance (#3452)
Conflicts: plugins/kolab_notes/kolab_notes.php plugins/libkolab/lib/kolab_format_configuration.php plugins/libkolab/lib/kolab_storage_cache_configuration.php plugins/libkolab/lib/kolab_storage_config.php
-rw-r--r--plugins/libkolab/lib/kolab_format_configuration.php24
-rw-r--r--plugins/libkolab/lib/kolab_storage_cache_configuration.php2
2 files changed, 25 insertions, 1 deletions
diff --git a/plugins/libkolab/lib/kolab_format_configuration.php b/plugins/libkolab/lib/kolab_format_configuration.php
index 5a8d3ff..174ab37 100644
--- a/plugins/libkolab/lib/kolab_format_configuration.php
+++ b/plugins/libkolab/lib/kolab_format_configuration.php
@@ -136,4 +136,28 @@ class kolab_format_configuration extends kolab_format
return $tags;
}
+ /**
+ * Callback for kolab_storage_cache to get words to index for fulltext search
+ *
+ * @return array List of words to save in cache
+ */
+ public function get_words()
+ {
+ $words = array();
+
+ foreach ((array)$this->data['members'] as $url) {
+ $member = kolab_storage_config::parse_member_url($url);
+
+ if (empty($member)) {
+ if (strpos($url, 'urn:uuid:') === 0) {
+ $words[] = substr($url, 9);
+ }
+ }
+ else if (!empty($member['params']['message-id'])) {
+ $words[] = $member['params']['message-id'];
+ }
+ }
+
+ return $words;
+ }
}
diff --git a/plugins/libkolab/lib/kolab_storage_cache_configuration.php b/plugins/libkolab/lib/kolab_storage_cache_configuration.php
index 8380aa8..8382852 100644
--- a/plugins/libkolab/lib/kolab_storage_cache_configuration.php
+++ b/plugins/libkolab/lib/kolab_storage_cache_configuration.php
@@ -37,4 +37,4 @@ class kolab_storage_cache_configuration extends kolab_storage_cache
return $sql_data;
}
-} \ No newline at end of file
+}