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); } }