SymfonySetup.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Hestia\WebApp\Installers\Symfony;
  3. use Hestia\WebApp\Installers\BaseSetup as BaseSetup;
  4. class SymfonySetup extends BaseSetup {
  5. protected $appInfo = [
  6. "name" => "Symfony",
  7. "group" => "framework",
  8. "enabled" => true,
  9. "version" => "latest",
  10. "thumbnail" => "symfony-thumb.png",
  11. ];
  12. protected $appname = "symfony";
  13. protected $config = [
  14. "form" => [],
  15. "database" => true,
  16. "resources" => [
  17. "composer" => ["src" => "symfony/website-skeleton", "dst" => "/"],
  18. ],
  19. "server" => [
  20. "nginx" => [
  21. "template" => "symfony4-5",
  22. ],
  23. "php" => [
  24. "supported" => ["8.2", "8.3"],
  25. ],
  26. ],
  27. ];
  28. public function install(array $options = null): bool {
  29. parent::install($options);
  30. $result = null;
  31. $htaccess_rewrite = '
  32. <IfModule mod_rewrite.c>
  33. RewriteEngine On
  34. RewriteRule ^(.*)$ public/$1 [L]
  35. </IfModule>';
  36. $this->appcontext->runComposer(
  37. ["config", "-d " . $this->getDocRoot(), "extra.symfony.allow-contrib", "true"],
  38. $result,
  39. );
  40. $this->appcontext->runComposer(
  41. ["require", "-d " . $this->getDocRoot(), "symfony/apache-pack"],
  42. $result,
  43. );
  44. $tmp_configpath = $this->saveTempFile($htaccess_rewrite);
  45. $this->appcontext->runUser(
  46. "v-move-fs-file",
  47. [$tmp_configpath, $this->getDocRoot(".htaccess")],
  48. $result,
  49. );
  50. return $result->code === 0;
  51. }
  52. }