Performance: SKip some SQL queries on "empty" tasklist refresh

This commit is contained in:
Aleksander Machniak 2016-02-24 12:54:08 +01:00
parent 46f962833f
commit 9ac901b90a
2 changed files with 9 additions and 4 deletions

View file

@ -567,12 +567,17 @@ class kolab_storage_config
/**
* Assign tags to kolab objects
*
* @param array $records List of kolab objects
* @param array $records List of kolab objects
* @param bool $no_return Don't return anything
*
* @return array List of tags
*/
public function apply_tags(&$records)
public function apply_tags(&$records, $no_return = false)
{
if (empty($records) && $no_return) {
return;
}
// first convert categories into tags
foreach ($records as $i => $rec) {
if (!empty($rec['categories'])) {
@ -603,7 +608,7 @@ class kolab_storage_config
$tags[] = $tag['name'];
}
$tags = array_unique($tags);
$tags = $no_return ? null : array_unique($tags);
return $tags;
}

View file

@ -597,7 +597,7 @@ class tasklist_kolab_driver extends tasklist_driver
}
}
$config->apply_tags($results);
$config->apply_tags($results, true);
$config->apply_links($results);
foreach (array_keys($results) as $idx) {