/** * Set the specified folder as default for its current type. * * @param array $folder The folder data. * @param string|boolean $previous The previous default folder or false if there was none. */ public function setDefault($folder, $previous = false) { if (!$this->_cache->hasNamespace()) { // Cache not synchronized yet. return; } if ($folder['namespace'] !== Horde_Kolab_Storage_Folder_Namespace::PERSONAL) { throw new Horde_Kolab_Storage_List_Exception(sprintf("Unable to mark %s as a default folder. It is not within your personal namespace!", $folder['folder'])); } $annotations = $this->_cache->getFolderTypes(); if (!isset($annotations[$folder['folder']])) { throw new Horde_Kolab_Storage_List_Exception(sprintf("The folder %s has no Kolab type. It cannot be marked as 'default' folder!", $folder['folder'])); } if ($previous) { $this->_driver->setAnnotation($previous, Horde_Kolab_Storage_List_Query_List::ANNOTATION_FOLDER_TYPE, $folder['type']); $annotations[$previous] = $folder['type']; } $this->_driver->setAnnotation($folder['folder'], Horde_Kolab_Storage_List_Query_List::ANNOTATION_FOLDER_TYPE, $folder['type'] . '.default'); $annotations[$folder['folder']] = $folder['type'] . '.default'; $folder_list = $this->_cache->getFolders(); $namespace = unserialize($this->_cache->getNamespace()); $this->_synchronize($namespace, $folder_list, $annotations); }
public function testID() { $cache = $this->getMockCache(); $list_cache = new Horde_Kolab_Storage_List_Cache($cache, array('host' => 'test', 'port' => '0', 'user' => 'test')); //$list_cache->setListId('test'); $list_cache->store(array(), array()); $list_cache->save(); $data = unserialize($cache->loadList($list_cache->getListId())); $this->assertEquals('a:3:{s:4:"host";s:4:"test";s:4:"port";s:1:"0";s:4:"user";s:4:"test";}', $data['I']); }
/** * Return the last sync stamp. * * @return string The stamp. */ public function getStamp() { return $this->_list_cache->getStamp(); }