Ejemplo n.º 1
0
 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>");
 }