Exemplo n.º 1
0
 public static function executeTransfer(InputInterface $input, OutputInterface $output)
 {
     list($source, $importLabel, $importIdKey, $readBatchSize, $nodeBatchSize, $relationBatchSize, $file, $clean, $transactional, $ignoredRelationProperties, $preserveIds) = DumpCommand::makeReadArguments($input);
     list($target) = ImportCommand::makeWriteArguments($input);
     if (!isset($file) || $file == 'default') {
         $file = DumpCommand::makeDumpFileName($source->getHost(), $output);
     }
     if (isset($file)) {
         $file = fopen($file, 'w+');
     }
     Neo4jTransfer::transfer($source, $target, $importLabel, $importIdKey, $readBatchSize, $nodeBatchSize, $relationBatchSize, $clean, $transactional, $ignoredRelationProperties, $preserveIds, $file, $output);
     if (isset($file)) {
         fclose($file);
     }
 }
Exemplo n.º 2
0
 public static function executeImport(InputInterface $input, OutputInterface $output)
 {
     list($target) = static::makeWriteArguments($input);
     $file = Neo4jTransfer::getWithDefault($input->getOptions(), 'input', null);
     if (isset($file)) {
         if (substr($file, 0, 5) == 'last:') {
             $hostname = substr($file, 5);
             $findFile = DumpCommand::makeDumpFileName($hostname, null, '*-*');
             $file = null;
             $timestamp = null;
             $from = strpos($findFile, '*');
             $rTo = strrpos($findFile, '*') - strlen($findFile) + 1;
             foreach (glob($findFile) as $filename) {
                 $ft = substr($filename, $from, $rTo);
                 if (!isset($timestamp) || $ft > $timestamp) {
                     $file = $filename;
                     $timestamp = $ft;
                 }
             }
             if (isset($file)) {
                 $output->writeln(sprintf("Importing from the latest dump for '%s':", $hostname));
                 $output->writeln($file . "\n");
             } else {
                 $output->writeln(sprintf("Unable to find the latest dump for '%s'.", $hostname));
                 exit(1);
             }
         }
     }
     if (isset($file)) {
         $file = fopen($file, 'r');
     }
     Neo4jTransfer::import($target, $file, $output);
     if (isset($file)) {
         fclose($file);
     }
 }
 public static function executeTransfer(InputInterface $input, OutputInterface $output)
 {
     list($source, $importLabel, $importIdKey, $readBatchSize, $nodeBatchSize, $relationBatchSize, $file, $clean, $transactional, $ignoredRelationProperties, $preserveIds) = DumpCommand::makeReadArguments($input, 300, 100, 150);
     list($target) = ImportCommand::makeWriteArguments($input);
     Neo4jTransfer::directTransfer($source, $target, $readBatchSize, $nodeBatchSize, $relationBatchSize, $ignoredRelationProperties, $preserveIds, $output);
 }