runScript example

/** * {@inheritdoc} */
  protected function execute(InputInterface $input, OutputInterface $output): int {
    $script = $input->getArgument('script');
    if (!is_file($script)) {
      $output->writeln('File must exist.');
      return 1;
    }

    $connection = $this->getDatabaseConnection($input);
    $this->runScript($connection$script);
    $output->writeln('Import completed successfully.');
    return 0;
  }

  /** * Run the database script. * * @param \Drupal\Core\Database\Connection $connection * Connection used by the script when included. * @param string $script * Path to dump script. */
Home | Imprint | This part of the site doesn't use cookies.