Performance: SKip some SQL queries on "empty" tasklist refresh
This commit is contained in:
parent
46f962833f
commit
9ac901b90a
2 changed files with 9 additions and 4 deletions
|
@ -567,12 +567,17 @@ class kolab_storage_config
|
||||||
/**
|
/**
|
||||||
* Assign tags to kolab objects
|
* 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
|
* @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
|
// first convert categories into tags
|
||||||
foreach ($records as $i => $rec) {
|
foreach ($records as $i => $rec) {
|
||||||
if (!empty($rec['categories'])) {
|
if (!empty($rec['categories'])) {
|
||||||
|
@ -603,7 +608,7 @@ class kolab_storage_config
|
||||||
$tags[] = $tag['name'];
|
$tags[] = $tag['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$tags = array_unique($tags);
|
$tags = $no_return ? null : array_unique($tags);
|
||||||
|
|
||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
|
|
@ -597,7 +597,7 @@ class tasklist_kolab_driver extends tasklist_driver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$config->apply_tags($results);
|
$config->apply_tags($results, true);
|
||||||
$config->apply_links($results);
|
$config->apply_links($results);
|
||||||
|
|
||||||
foreach (array_keys($results) as $idx) {
|
foreach (array_keys($results) as $idx) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue