setPingableCollection() public method

Set a specific collection to be PINGable.
public setPingableCollection ( string $id )
$id string The collection id.
Beispiel #1
0
 /**
  * Marks all loaded collections with a synckey as pingable.
  */
 public function updatePingableFlag()
 {
     $collections = $this->_cache->getCollections(false);
     foreach ($collections as $id => $collection) {
         if (!empty($this->_collections[$id]['synckey'])) {
             $this->_logger->info(sprintf('Setting collection %s (%s) PINGABLE.', $collection['serverid'], $id));
             $this->_cache->setPingableCollection($id);
         } else {
             $this->_logger->info(sprintf('UNSETTING collection %s (%s) PINGABLE flag.', $collection['serverid'], $id));
             $this->_cache->removePingableCollection($id);
         }
     }
 }
Beispiel #2
0
 protected function _testCacheCollections()
 {
     $collections = array('519422f1-4c5c-4547-946a-1701c0a8015f' => array('class' => 'Email', 'windowsize' => 5, 'truncation' => 0, 'mimesupport' => 0, 'mimetruncation' => 8, 'conflict' => 1, 'bodyprefs' => array('wanted' => 2, 2 => array('type' => 2, 'truncationsize' => 200000)), 'deletesasmoves' => 1, 'filtertype' => 5, 'id' => '519422f1-4c5c-4547-946a-1701c0a8015f', 'serverid' => 'INBOX'), '@Contacts@' => array('class' => 'Contacts', 'windowsize' => 4, 'truncation' => 0, 'mimesupport' => 0, 'mimetruncation' => 8, 'conflict' => 1, 'bodyprefs' => array('wanted' => 1, 1 => array('type' => 1, 'truncationsize' => 200000)), 'deletesasmoves' => 1, 'id' => '@Contacts@', 'serverid' => '@Contacts@'));
     $cache = new Horde_ActiveSync_SyncCache(self::$state, 'dev123', 'mike', self::$logger->getLogger());
     foreach ($collections as $collection) {
         $cache->addCollection($collection);
     }
     // Mangle the fixture to match what we expect.
     $collections['519422f1-4c5c-4547-946a-1701c0a8015f']['rtftruncation'] = null;
     $collections['@Contacts@']['rtftruncation'] = null;
     $collections['@Contacts@']['filtertype'] = null;
     $this->assertEquals(2, $cache->countCollections());
     $this->assertEquals($collections, $cache->getCollections(false));
     $this->assertEquals(array(), $cache->getCollections(true));
     $this->assertEquals(true, $cache->collectionExists('@Contacts@'));
     $this->assertEquals(true, $cache->collectionExists('519422f1-4c5c-4547-946a-1701c0a8015f'));
     $this->assertEquals(false, $cache->collectionExists('foo'));
     $this->assertEquals(false, $cache->collectionIsPingable('@Contacts@'));
     $cache->setPingableCollection('@Contacts@');
     $this->assertEquals(true, $cache->collectionIsPingable('@Contacts@'));
     $cache->removePingableCollection('@Contacts@');
     $this->assertEquals(false, $cache->collectionIsPingable('@Contacts@'));
     $cache->updateCollection(array('id' => '519422f1-4c5c-4547-946a-1701c0a8015f', 'newsynckey' => '{51941e99-0b9c-41f8-b678-1532c0a8015f}2'), array('newsynckey' => true));
     $cache->save();
     // Now we should have a lastsynckey
     $this->assertEquals(1, count($cache->getCollections()));
     // And still have 2 if we don't need a synckey
     $this->assertEquals(2, count($cache->getCollections(false)));
 }