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 testLoadNode2() { $runName = uniqid('', true); $fileName = 'testfile_node_tcp2_' . date('Ymd_His') . '_' . $runName . '.yml'; $node = new Node('test_data/' . $fileName); $node->setDatadirBasePath('test_data'); $this->assertFalse($node->load()); }