dump-database-d8-mysql.php 748 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env php
  2. <?php
  3. /**
  4. * @file
  5. * A command line application to dump a database to a generation script.
  6. */
  7. use Drupal\Core\Command\DbDumpApplication;
  8. use Drupal\Core\DrupalKernel;
  9. use Drupal\Core\Site\Settings;
  10. use Symfony\Component\HttpFoundation\Request;
  11. if (PHP_SAPI !== 'cli') {
  12. return;
  13. }
  14. // Bootstrap.
  15. $autoloader = require __DIR__ . '/../../autoload.php';
  16. require_once __DIR__ . '/../includes/bootstrap.inc';
  17. $request = Request::createFromGlobals();
  18. Settings::initialize(dirname(dirname(__DIR__)), DrupalKernel::findSitePath($request), $autoloader);
  19. $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot();
  20. // Run the database dump command.
  21. $application = new DbDumpApplication();
  22. $application->run();