Permissions.php 891 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Grav\Plugin\Problems;
  3. use Grav\Plugin\Problems\Base\Problem;
  4. class Permissions extends Problem
  5. {
  6. public function __construct()
  7. {
  8. $this->id = 'Permissions Setup';
  9. $this->class = get_class($this);
  10. $this->order = -1;
  11. $this->level = Problem::LEVEL_WARNING;
  12. $this->status = false;
  13. $this->help = 'https://learn.getgrav.org/troubleshooting/permissions';
  14. }
  15. public function process()
  16. {
  17. umask($umask = umask(022));
  18. $msg = "Your default file umask is <strong>%s</strong> which %s";
  19. if (($umask & 2) !== 2) {
  20. $this->msg = sprintf($msg, decoct($umask), 'is potentially dangerous');
  21. $this->status = false;
  22. } else {
  23. $this->msg = sprintf($msg, decoct($umask), 'looks good!');
  24. $this->status = true;
  25. }
  26. return $this;
  27. }
  28. }