/** * {@inheritdoc} */ public function restore(Filesystem $source, Filesystem $destination, ReadonlyDatabase $database, array $parameter) { $this->output->writeln(' * <comment>import "export.xml" to "' . $parameter['path'] . '"</comment>'); $tempfile = $this->temporaryFileSystem->createTemporaryFile('jackrabbit'); $handle = fopen($tempfile, 'w+'); file_put_contents($tempfile, $source->read('export.xml')); fclose($handle); $this->import($this->getSession($parameter), $parameter['path'], $tempfile); }
/** * {@inheritdoc} */ public function restore(Filesystem $source, Filesystem $destination, ReadonlyDatabase $database, array $parameter) { $tempFile = $this->temporaryFileSystem->createTemporaryFile('mysql'); file_put_contents($tempFile, $source->read('dump.sql')); $process = new Process($this->getImportCommand($parameter['username'], $parameter['password'], $parameter['database'], $tempFile)); $process->run(); while ($process->isRunning()) { // waiting for process to finish } $this->output->writeln(sprintf(' * <comment>%s</comment>', $this->getImportCommand($parameter['username'], $parameter['password'], $parameter['database'], 'dump.sql', true))); }
/** * {@inheritdoc} */ public function open($name) { $tempFileName = $this->temporaryFileSystem->createTemporaryFile(); $stream = $this->localFilesystem->readStream(sprintf('%s/%s.zip', $this->name, $name)); file_put_contents($tempFileName, $stream); $filesystem = new Filesystem(new ReadonlyAdapter(new ZipArchiveAdapter($tempFileName))); $filesystem->addPlugin(new ListFiles()); return $filesystem; }
public function testRemoteListingNoRemote() { $this->setExpectedException(RemoteStorageNotConfiguredException::class); $storage = new LocalStorage($this->name, $this->temporaryFileSystem->reveal(), $this->slugify->reveal(), $this->filesystem->reveal(), $this->localFilesystem->reveal()); $storage->remoteListing(); }