Horde_Kolab_Storage_List_Query_List_Cache_Synchronization::_synchronize PHP Method

_synchronize() public method

Synchronize based on the given folder list.
public _synchronize ( Horde_Kolab_Storage_Folder_Namespace $namespace, array $folder_list, $annotations ) : null
$namespace Horde_Kolab_Storage_Folder_Namespace The namespace handler
$folder_list array The list of folders.
return null
    public function _synchronize(Horde_Kolab_Storage_Folder_Namespace $namespace, $folder_list, $annotations)
    {
        $folders = array();
        $owners = array();
        $types = array();
        $by_type = array();
        $mail_type = $this->_folder_types->create('mail');
        $this->_defaults->reset();
        foreach ($folder_list as $folder) {
            $folder = strval($folder);
            if (!isset($annotations[$folder])) {
                $type = $mail_type;
            } else {
                $type = $this->_folder_types->create($annotations[$folder]);
            }
            $folder_type = $type->getType();
            $owner = $namespace->getOwner($folder);
            $owners[$folder] = $owner;
            $types[$folder] = $type->getType();
            $data = new Horde_Kolab_Storage_Folder_Data($folder, $type, $namespace);
            $dataset = $data->toArray();
            $folders[$folder] = $dataset;
            $by_type[$folder_type][$folder] = $dataset;
            if ($folders[$folder]['default']) {
                $this->_defaults->rememberDefault($folder, $folder_type, $owner, $folders[$folder]['namespace'] == Horde_Kolab_Storage_Folder_Namespace::PERSONAL);
            }
        }
        $this->_cache->store($folder_list, $annotations);
        if (!$this->_cache->hasNamespace()) {
            $this->_cache->setNamespace(serialize($namespace));
        }
        $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::TYPES, $types);
        $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::FOLDERS, $folders);
        $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::OWNERS, $owners);
        $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::BY_TYPE, $by_type);
        $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::DEFAULTS, $this->_defaults->getDefaults());
        $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::PERSONAL_DEFAULTS, $this->_defaults->getPersonalDefaults());
        $this->_cache->save();
    }