/** * @param \ArrayObject $project * * @return mixed */ public function create(\ArrayObject $project) { $this->fileSystemProvider->createDirectory($project, 'php-fpm'); $permissionDefinition = new PermissionDefinition(); $permissionDefinition->setPath("/php-fpm"); $permissionDefinition->setOwnership("-R @project.user@.@project.group@"); $permissionDefinition->addAcl("-R -m user::rwX"); $permissionDefinition->addAcl("-R -m group::r-X"); $permissionDefinition->addAcl("-R -m other::---"); $permissionDefinition->addAcl("-R -m u:@config.wwwuser@:r-X"); $project["permissions"]["/php-fpm"] = $permissionDefinition; $this->fileSystemProvider->createDirectory($project, 'tmp'); $permissionDefinition = new PermissionDefinition(); $permissionDefinition->setPath("/tmp"); $permissionDefinition->setOwnership("-R @project.user@.@project.group@"); $permissionDefinition->addAcl("-R -m user::rwX"); $permissionDefinition->addAcl("-R -m group::r-X"); $permissionDefinition->addAcl("-R -m other::---"); $permissionDefinition->addAcl("-R -m u:@config.wwwuser@:r-X"); $project["permissions"]["/tmp"] = $permissionDefinition; $this->fileSystemProvider->render("/php/nginx.d/19php.conf.twig", $this->fileSystemProvider->getProjectConfigDirectory($project["name"]) . "/nginx.d/19php", array()); $this->fileSystemProvider->render("/php/nginx.d/10location.conf.twig", $this->fileSystemProvider->getProjectConfigDirectory($project["name"]) . "/nginx.d/10location", array()); $this->fileSystemProvider->renderDistConfig($this->fileSystemProvider->getConfigTemplateDir("php"), $this->fileSystemProvider->getConfigTemplateDir("php", true), $this->fileSystemProvider->getProjectConfigDirectory($project["name"]) . "/apache.d/"); $this->fileSystemProvider->render("/php/fcron.d/01php.twig", $this->fileSystemProvider->getProjectConfigDirectory($project["name"]) . "/fcron.d/01php", array("projectdir" => $this->fileSystemProvider->getProjectDirectory($project["name"]))); }
/** * @param $path * @param \ArrayObject $project * @return \ArrayObject */ private function addReadWriteFolder($path, \ArrayObject $project) { $permissionDefinition = new PermissionDefinition(); $permissionDefinition->setPath($path); $permissionDefinition->setOwnership("-R @project.user@.@project.group@"); $permissionDefinition->addAcl("-R -m user::rwX"); $permissionDefinition->addAcl("-R -m group::r-X"); $permissionDefinition->addAcl("-R -m other::---"); $permissionDefinition->addAcl("-R -m u:@config.wwwuser@:rwX"); $project["permissions"][$path] = $permissionDefinition; return $project; }
/** * @param string $projectname * @param \ArrayObject $config * @return \ArrayObject */ private function loadOwnership($projectname, \ArrayObject $config) { $configPath = $this->fileSystemProvider->getProjectConfigDirectory($projectname) . "/ownership.xml"; $xml = simplexml_load_file($configPath); foreach ($xml->{'var'} as $var) { $name = (string) $var["name"]; $value = (string) $var["value"]; if (isset($config["permissions"][$name])) { $permissionDefinition = $config["permissions"][$name]; } else { $permissionDefinition = new PermissionDefinition(); } $permissionDefinition->setPath($name); $permissionDefinition->setOwnership($value); $config["permissions"][$name] = $permissionDefinition; } return $config; }
/** * @param \ArrayObject $project * * @return mixed */ public function create(\ArrayObject $project) { $permissionDefinition = new PermissionDefinition(); $permissionDefinition->setPath("/"); $permissionDefinition->setOwnership("@config.superuser@.@project.group@"); $permissionDefinition->addAcl("-R -m user::rwX"); $permissionDefinition->addAcl("-R -m group::r-X"); $permissionDefinition->addAcl("-R -m other::---"); $permissionDefinition->addAcl("-R -m u:@config.wwwuser@:r-X"); $permissionDefinition->addAcl("-R -m u:@project.user@:rwX"); $permissionDefinition->addAcl("-R -m u:@config.postgresuser@:r-X"); $permissionDefinition->addAcl("-R -m group:admin:rwX"); $project["permissions"]["/"] = $permissionDefinition; $this->fileSystemProvider->createDirectory($project, '.ssh'); $permissionDefinition = new PermissionDefinition(); $permissionDefinition->setPath("/.ssh"); $permissionDefinition->setOwnership("-R @project.user@.@project.group@"); $permissionDefinition->addAcl("-R -m user::rwX"); $permissionDefinition->addAcl("-R -m group::---"); $permissionDefinition->addAcl("-R -m other::---"); $permissionDefinition->addAcl("-R -m m::---"); $project["permissions"]["/.ssh"] = $permissionDefinition; $this->fileSystemProvider->createDirectory($project, 'stats'); $permissionDefinition = new PermissionDefinition(); $permissionDefinition->setPath("/stats"); $permissionDefinition->setOwnership("-R @project.user@.@project.group@"); $permissionDefinition->addAcl("-R -m user::rwX"); $permissionDefinition->addAcl("-R -m group::r-X"); $permissionDefinition->addAcl("-R -m u:@config.wwwuser@:r-X"); $permissionDefinition->addAcl("-R -m group:admin:r-X"); $project["permissions"]["/stats"] = $permissionDefinition; $this->fileSystemProvider->createDirectory($project, 'apachelogs'); $permissionDefinition = new PermissionDefinition(); $permissionDefinition->setPath("/apachelogs"); $permissionDefinition->setOwnership("-R @project.user@.@project.group@"); $permissionDefinition->addAcl("-R -m user::rwX"); $permissionDefinition->addAcl("-R -m group::r-X"); $permissionDefinition->addAcl("-R -m other::---"); $permissionDefinition->addAcl("-R -m u:@config.wwwuser@:rwX"); $project["permissions"]["/apachelogs"] = $permissionDefinition; $this->fileSystemProvider->createDirectory($project, 'site'); $permissionDefinition = new PermissionDefinition(); $permissionDefinition->setPath("/site"); $permissionDefinition->setOwnership("-R @project.user@.@project.group@"); $permissionDefinition->addAcl("-R -m user::rwX"); $permissionDefinition->addAcl("-R -m group::r-X"); $permissionDefinition->addAcl("-R -m other::---"); $permissionDefinition->addAcl("-R -m u:@config.wwwuser@:r-X"); $project["permissions"]["/site"] = $permissionDefinition; $this->fileSystemProvider->createDirectory($project, 'backup'); $permissionDefinition = new PermissionDefinition(); $permissionDefinition->setPath("/backup"); $permissionDefinition->setOwnership("-R @project.user@.@project.group@"); $permissionDefinition->addAcl("-R -m user::rwX"); $permissionDefinition->addAcl("-R -m group::r-X"); $permissionDefinition->addAcl("-R -m other::---"); $permissionDefinition->addAcl("-R -m u:@config.postgresuser@:rwX"); $project["permissions"]["/backup"] = $permissionDefinition; $this->fileSystemProvider->createDirectory($project, 'data'); $permissionDefinition = new PermissionDefinition(); $permissionDefinition->setPath("/data"); $permissionDefinition->setOwnership("-R @project.user@.@project.group@"); $permissionDefinition->addAcl("-R -m user::rwX"); $permissionDefinition->addAcl("-R -m group::r-X"); $permissionDefinition->addAcl("-R -m other::---"); $project["permissions"]["/data"] = $permissionDefinition; $this->fileSystemProvider->createDirectory($project, 'conf'); $permissionDefinition = new PermissionDefinition(); $permissionDefinition->setPath("/conf"); $permissionDefinition->setOwnership("-R @config.superuser@.@project.group@"); $permissionDefinition->addAcl("-R -m user::rwX"); $permissionDefinition->addAcl("-R -m group::r-X"); $permissionDefinition->addAcl("-R -m other::---"); $project["permissions"]["/conf"] = $permissionDefinition; $project["backupexcludes"]["error.log"] = "error.log"; $project["backupexcludes"]["access.log*"] = "access.log*"; }