generate-proxy-class.php 954 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env php
  2. <?php
  3. /**
  4. * @file
  5. * A script to generate proxy classes for lazy services.
  6. *
  7. * For help, type this command from the root directory of an installed Drupal
  8. * site: php core/scripts/generate-proxy-class.php -h generate-proxy-class
  9. *
  10. * @ingroup container
  11. *
  12. * @see lazy_services
  13. */
  14. use Drupal\Core\Command\GenerateProxyClassApplication;
  15. use Drupal\Core\DrupalKernel;
  16. use Drupal\Core\ProxyBuilder\ProxyBuilder;
  17. use Drupal\Core\Site\Settings;
  18. use Symfony\Component\HttpFoundation\Request;
  19. if (PHP_SAPI !== 'cli') {
  20. return;
  21. }
  22. // Bootstrap.
  23. $autoloader = require __DIR__ . '/../../autoload.php';
  24. $request = Request::createFromGlobals();
  25. Settings::initialize(dirname(__DIR__, 2), DrupalKernel::findSitePath($request), $autoloader);
  26. DrupalKernel::createFromRequest($request, $autoloader, 'prod')->boot();
  27. // Run the database dump command.
  28. $application = new GenerateProxyClassApplication(new ProxyBuilder());
  29. $application->run();