public function load() { #print __CLASS__.'->'.__FUNCTION__.''."\n"; #fwrite(STDOUT, 'load node'."\n"); if (parent::load()) { $this->setIdHexStr($this->data['id']); if ($this->data) { if (array_key_exists('sslKeyPub', $this->data)) { if ($this->data['sslKeyPub']) { $this->setSslKeyPub(base64_decode($this->data['sslKeyPub'])); } unset($this->data['sslKeyPub']); } if (array_key_exists('uri', $this->data)) { #fwrite(STDOUT, 'load node: uri /'.$this->data['uri'].'/'."\n"); if ($this->data['uri']) { $this->setUri($this->data['uri']); } unset($this->data['uri']); } } return true; } return false; }
public function load() { #print __CLASS__.'->'.__FUNCTION__.''."\n"; if (parent::load()) { $this->setSrcSslKeyPub(base64_decode($this->data['srcSslKeyPub'])); unset($this->data['srcSslKeyPub']); return true; } return false; }
public function load() { if (parent::load()) { if (array_key_exists('msgs', $this->data) && $this->data['msgs']) { foreach ($this->data['msgs'] as $msgId => $msgAr) { $this->msgsByPath[$msgAr['path']] = $msgAr; } } return true; } return false; }
public function load() { #print __CLASS__.'->'.__FUNCTION__.''."\n"; if (parent::load()) { if ($this->data) { /*if(array_key_exists('buckets', $this->data) && $this->data['buckets']){ foreach($this->data['buckets'] as $bucketId => $bucketAr){ if(file_exists($bucketAr['path'])){ $bucket = new Bucket($bucketAr['path']); $bucket->setDatadirBasePath($this->getDatadirBasePath()); $bucket->setLocalNode($this->getLocalNode()); if($bucket->load()){ $this->buckets[$bucketId] = $bucket; $this->bucketsByMask[$bucket->getMask()] = $bucket; } } } }*/ /*if(array_key_exists('childBucketUpper', $this->data) && $this->data['childBucketUpper']){ $this->childBucketUpper = new Bucket($this->data['childBucketUpper']); $this->childBucketUpper->setDatadirBasePath($this->getDatadirBasePath()); $this->childBucketUpper->setLocalNode($this->getLocalNode()); $this->childBucketUpper->load(); } if(array_key_exists('childBucketLower', $this->data) && $this->data['childBucketLower']){ $this->childBucketLower = new Bucket($this->data['childBucketLower']); $this->childBucketLower->setDatadirBasePath($this->getDatadirBasePath()); $this->childBucketLower->setLocalNode($this->getLocalNode()); $this->childBucketLower->load(); }*/ if (array_key_exists('rootBucket', $this->data) && $this->data['rootBucket']) { $this->rootBucket = new Bucket($this->data['rootBucket']); $this->rootBucket->setDatadirBasePath($this->getDatadirBasePath()); $this->rootBucket->setLocalNode($this->getLocalNode()); $this->rootBucket->load(); } } #unset($this->data['buckets']); #unset($this->data['childBucketUpper']); #unset($this->data['childBucketLower']); unset($this->data['rootBucket']); #$this->data['bucketsId'] = (int)$this->data['bucketsId']; return true; } return false; }
public function load() { #fwrite(STDOUT, __CLASS__.'->'.__FUNCTION__.''."\n"); if (parent::load()) { if (isset($this->data['hashcashs']) && $this->data['hashcashs']) { foreach ($this->data['hashcashs'] as $hashcashId => $hashcashAr) { $this->hashcashsId = $hashcashId; #fwrite(STDOUT, __CLASS__.'->'.__FUNCTION__.': '.$this->hashcashsId."\n"); $hashcash = new Hashcash(); if ($hashcash->verify($hashcashAr['stamp'])) { $this->hashcashs[$hashcashId] = $hashcash; } } } unset($this->data['hashcashs']); return true; } return false; }
public function load() { #print __CLASS__.'->'.__FUNCTION__.''."\n"; if (parent::load()) { if (array_key_exists('msgs', $this->data) && $this->data['msgs']) { foreach ($this->data['msgs'] as $msgId => $msgAr) { if (file_exists($msgAr['path'])) { $msg = new Msg($msgAr['path']); $msg->setDatadirBasePath($this->getDatadirBasePath()); if ($msg->load()) { #print __CLASS__.'->'.__FUNCTION__.': '.$msg->getId().', '.$msg->getStatus()."\n"; $this->msgs[$msg->getId()] = $msg; } } } } unset($this->data['msgs']); return true; } return false; }
public function load() { #print __CLASS__.'->'.__FUNCTION__.''."\n"; #fwrite(STDOUT, __FUNCTION__.': '.$this->getFilePath().''."\n"); if (parent::load()) { if ($this->data) { if (array_key_exists('nodes', $this->data) && $this->data['nodes']) { foreach ($this->data['nodes'] as $nodeId => $nodeAr) { if (file_exists($nodeAr['path'])) { #$this->nodesId = $nodeId; $node = new Node($nodeAr['path']); $node->setDatadirBasePath($this->getDatadirBasePath()); $node->setBucket($this); if ($node->load()) { #$this->nodes[$this->nodesId] = $node; $this->nodes[$nodeId] = $node; } } } } if (array_key_exists('childBucketUpper', $this->data) && $this->data['childBucketUpper']) { $this->childBucketUpper = new Bucket($this->data['childBucketUpper']); $this->childBucketUpper->setDatadirBasePath($this->getDatadirBasePath()); $this->childBucketUpper->setLocalNode($this->getLocalNode()); $this->childBucketUpper->load(); } if (array_key_exists('childBucketLower', $this->data) && $this->data['childBucketLower']) { $this->childBucketLower = new Bucket($this->data['childBucketLower']); $this->childBucketLower->setDatadirBasePath($this->getDatadirBasePath()); $this->childBucketLower->setLocalNode($this->getLocalNode()); $this->childBucketLower->load(); } } unset($this->data['nodes']); unset($this->data['childBucketUpper']); unset($this->data['childBucketLower']); return true; } return false; }
public function load() { #print __CLASS__.'->'.__FUNCTION__.''."\n"; if (parent::load()) { if ($this->data) { if (array_key_exists('nodes', $this->data) && $this->data['nodes']) { foreach ($this->data['nodes'] as $nodeId => $nodeAr) { if (file_exists($nodeAr['path'])) { $node = new Node($nodeAr['path']); $node->setDatadirBasePath($this->getDatadirBasePath()); if ($node->load()) { $this->nodes[$nodeId] = $node; } } } } } unset($this->data['nodes']); return true; } return false; }
public function load() { #print __CLASS__.'->'.__FUNCTION__.''."\n"; if (parent::load()) { if (isset($this->data['contacts']) && $this->data['contacts']) { foreach ($this->data['contacts'] as $contactId => $contactAr) { #$this->contactsId++; $this->contactsId = (int) $contactId; #print __CLASS__.'->'.__FUNCTION__.': '.$this->contactsId."\n"; $contact = new Contact(); $contact->setId($this->contactsId); $contact->setNodeId($contactAr['nodeId']); $contact->setUserNickname($contactAr['userNickname']); $contact->setTimeCreated($contactAr['timeCreated']); $this->contacts[$contact->getId()] = $contact; $this->contactsByNodeId[$contact->getNodeId()] = $contact; } } unset($this->data['contacts']); return true; } return false; }
public function testLoad2() { $storage = new YamlStorage('test_data/test2.yml'); $storage->load(); $this->assertFalse($storage->isLoaded()); }
public function init() { // @codeCoverageIgnoreStart if (!TEST) { $this->initIpcKernelConnection(); $this->sttySetup(); } // @codeCoverageIgnoreEnd $this->keybindingsSetup(); // @codeCoverageIgnoreStart if ($this->ipcKernelConnection) { $this->settings = $this->ipcKernelConnection->execSync('getSettings'); } // @codeCoverageIgnoreEnd $this->userNickname = $this->settings->data['user']['nickname']; $historyStoragePath = $this->settings->data['datadir'] . '/history.yml'; if ($this->settings->data['console']['history']['enabled'] && $this->settings->data['console']['history']['saveToFile'] && file_exists($historyStoragePath)) { $this->log->info('load history'); $historyStorage = new YamlStorage($historyStoragePath); if ($historyStorage->load()) { if ($this->settings->data['console']['history']['entriesMax']) { $this->history = array_slice($historyStorage->data, 0, $this->settings->data['console']['history']['entriesMax']); } else { $this->history = $historyStorage->data; } } } // @codeCoverageIgnoreStart if (!TEST) { fwrite(STDOUT, PHP_EOL . "Type '/help' for help." . PHP_EOL); } // @codeCoverageIgnoreEnd $this->msgAdd('start', true, true); return true; }