summaryrefslogtreecommitdiff
path: root/plugins/tasklist
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-11-27 12:11:54 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-11-27 12:11:54 (GMT)
commit87723eb9bb6e1616a03f2cfe14755e9d48f76a4a (patch)
tree6905b4e75a17d1684ae3c6d9f7c8416fc50bae6f /plugins/tasklist
parent6a7488f7311dc337270119ada1b8edeaa33c5054 (diff)
downloadroundcubemail-plugins-kolab-87723eb9bb6e1616a03f2cfe14755e9d48f76a4a.tar.gz
Performance: skip relation checks when only counting tasks (#3969)
Diffstat (limited to 'plugins/tasklist')
-rw-r--r--plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php b/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
index e94565e..97cdb63 100644
--- a/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
+++ b/plugins/tasklist/drivers/kolab/tasklist_kolab_driver.php
@@ -490,7 +490,7 @@ class tasklist_kolab_driver extends tasklist_driver
continue;
}
foreach ($folder->select(array(array('tags','!~','x-complete'))) as $record) {
- $rec = $this->_to_rcube_task($record, $list_id);
+ $rec = $this->_to_rcube_task($record, $list_id, false);
if ($this->is_complete($rec)) // don't count complete tasks
continue;
@@ -691,7 +691,7 @@ class tasklist_kolab_driver extends tasklist_driver
if (!($record['valarms'] || $record['alarms']) || $record['status'] == 'COMPLETED' || $record['complete'] == 100) // don't trust query :-)
continue;
- $task = $this->_to_rcube_task($record, $lid);
+ $task = $this->_to_rcube_task($record, $lid, false);
// add to list if alarm is set
$alarm = libcalendaring::get_next_alarm($task, 'task');
@@ -923,7 +923,7 @@ class tasklist_kolab_driver extends tasklist_driver
/**
* Convert from Kolab_Format to internal representation
*/
- private function _to_rcube_task($record, $list_id)
+ private function _to_rcube_task($record, $list_id, $all = true)
{
$id_prefix = $list_id . ':';
$task = array(
@@ -941,10 +941,14 @@ class tasklist_kolab_driver extends tasklist_driver
'organizer' => $record['organizer'],
'sequence' => $record['sequence'],
'tags' => $record['tags'],
- 'links' => $this->get_links($record['uid']),
'list' => $list_id,
);
+ // we can sometimes skip this expensive operation
+ if ($all) {
+ $task['links'] = $this->get_links($task['uid']);
+ }
+
// convert from DateTime to internal date format
if (is_a($record['due'], 'DateTime')) {
$due = $this->plugin->lib->adjust_timezone($record['due']);