collectionIsPingable() public method

Check if a specified collection is PINGable.
public collectionIsPingable ( string $id ) : boolean
$id string The collection id.
return boolean
Esempio n. 1
0
 /**
  * Check if we have any pingable collections.
  *
  * @return boolean  True if we have collections marked as pingable.
  */
 public function havePingableCollections()
 {
     foreach (array_keys($this->_collections) as $id) {
         if ($this->_cache->collectionIsPingable($id)) {
             return true;
         }
     }
     return false;
 }
Esempio n. 2
0
File: Base.php Progetto: horde/horde
 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)));
 }