Before.php 1023 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxVps\Core\Configuration\Addon\Activate;
  3. use \ModulesGarden\Servers\ProxmoxVps\Core\Configuration\Addon\AbstractBefore;
  4. use \ModulesGarden\Servers\ProxmoxVps\Core\ModuleConstants;
  5. use \ModulesGarden\Servers\ProxmoxVps\Core\ServiceLocator;
  6. /**
  7. * Runs before module activation actions
  8. *
  9. * @author Rafał Ossowski <rafal.os@modulesgarden.com>
  10. */
  11. class Before extends AbstractBefore
  12. {
  13. /**
  14. * @param array $params
  15. * @return array
  16. */
  17. public function execute(array $params = [])
  18. {
  19. $path = ModuleConstants::getModuleRootDir() . DS . 'storage';
  20. if (is_writable($path) === false || is_readable($path) === false)
  21. {
  22. $params['status'] = 'error';
  23. $params['description'] .= PHP_EOL . ServiceLocator::call('lang')
  24. ->addReplacementConstant('storage_path', ModuleConstants::getFullPath('storage'))
  25. ->absoluteT('permissionsStorage');
  26. }
  27. return $params;
  28. }
  29. }