Ejemplo n.º 1
0
 private function nodeAdd(Node $node, $sortNodes = true)
 {
     $nodeId = $node->getIdHexStr();
     $filePath = null;
     if ($this->getDatadirBasePath()) {
         #$filePath = $this->getDatadirBasePath().'/node_'.$node->getIdHexStr().'.yml';
         #$filePath = $this->getDatadirBasePath().'/node_'.$node->getIdHexStr().'_'.mt_rand(1000, 9999).'.yml';
         #$filePath = $this->getDatadirBasePath().'/node_'.substr($nodeId, -5).'_'.time().'.yml';
         #$filePath = $this->getDatadirBasePath().'/node_'.substr($nodeId, -5).'.yml';
         $filePath = $this->getDatadirBasePath() . '/node_' . $nodeId . '.yml';
     }
     if (!$node->getFilePath()) {
         $node->setFilePath($filePath);
     }
     $node->setDatadirBasePath($this->getDatadirBasePath());
     $node->setBucket($this);
     $node->setDataChanged(true);
     #$this->nodesId++;
     #$this->nodes[$this->nodesId] = $node;
     $this->nodes[$nodeId] = $node;
     $this->isFull();
     $this->setDataChanged(true);
     /*if($sortNodes){
     			$this->nodesSort();
     		}*/
 }