public setMigrationFiles ( $files ) : |
||
Результат |
public function setMigrationFiles($files)
{
parent::setMigrationFiles($files);
if ($this->getError()) {
return $this;
}
$this->hash = md5($files);
$file =& $this->files[$this->hash];
if ($file['type'] === 'yaml') {
$file['handler'] = new Output\YamlFile($this, $file['file']);
} elseif ($file['type'] === 'json') {
$file['handler'] = new Output\JsonFile($this, $file['file']);
}
return $this;
}
protected function execute(InputInterface $input, OutputInterface $output) { // Warn that this is experimental $output->writeln("<error>\n\nWARNING THIS IS AN EXPERIMENTAL FEATURE\n</error>\n"); // Check if export file can be created $file = $input->getOption('file'); if (empty($file)) { throw new \RuntimeException('The --file option is required.'); } // See if we're going to continue if ($this->checkContinue($input, $output) === false) { return; } // Get the Bolt Export migration object $export = new Export($this->app); // Check the file extension is valid and writeable $export->setMigrationFiles($file)->checkMigrationFilesValid(false)->checkMigrationFilesExist('export')->checkMigrationFilesWriteable()->checkContenttypeValid($input->getOption('contenttypes'))->exportContenttypesRecords(); if ($export->getError()) { foreach ($export->getErrorMessages() as $error) { $output->writeln("<error>{$error}</error>"); } $output->writeln("\n<error>Aborting export!</error>\n"); return 1; } $output->writeln("<info>Database exported to {$file}</info>"); }