Skouter mortgage estimates. Web application with view written in PHP and Vue, but controller and models in Go.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

62 lines
1.7 KiB

  1. <?php
  2. namespace Grav\Plugin\Problems;
  3. use Grav\Plugin\Problems\Base\Problem;
  4. /**
  5. * Class Apache
  6. * @package Grav\Plugin\Problems
  7. */
  8. class Apache extends Problem
  9. {
  10. public function __construct()
  11. {
  12. $this->id = 'Apache Modules';
  13. $this->class = get_class($this);
  14. $this->order = 1;
  15. $this->level = Problem::LEVEL_CRITICAL;
  16. $this->status = true;
  17. $this->help = 'https://learn.getgrav.org/basics/requirements#apache-requirements';
  18. }
  19. /**
  20. * @return $this
  21. */
  22. public function process()
  23. {
  24. // Perform some Apache checks
  25. if (function_exists('apache_get_modules') && strpos(PHP_SAPI, 'apache') !== false) {
  26. $require_apache_modules = ['mod_rewrite'];
  27. $apache_modules = apache_get_modules();
  28. $apache_errors = [];
  29. $apache_success = [];
  30. foreach ($require_apache_modules as $module) {
  31. if (in_array($module, $apache_modules, true)) {
  32. $apache_success[$module] = 'module required but not enabled';
  33. } else {
  34. $apache_errors[$module] = 'module is not installed or enabled';
  35. }
  36. }
  37. if (empty($apache_errors)) {
  38. $this->status = true;
  39. $this->msg = 'All modules look good!';
  40. } else {
  41. $this->status = false;
  42. $this->msg = 'There were problems with required modules:';
  43. }
  44. $this->details = ['errors' => $apache_errors, 'success' => $apache_success];
  45. } else {
  46. $this->msg = 'Apache not installed, skipping...';
  47. }
  48. return $this;
  49. }
  50. }