Skip to content
Snippets Groups Projects
Commit aa9adbbd authored by Sebastien's avatar Sebastien
Browse files

WIP capsule create from prototype

parent 60a542b0
No related branches found
No related tags found
1 merge request!84Tuleap 198 get rid of create zip
...@@ -11,6 +11,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; ...@@ -11,6 +11,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Config\Util\Exception\XmlParsingException; use Symfony\Component\Config\Util\Exception\XmlParsingException;
use Symfony\Component\Filesystem\Exception\FileNotFoundException; use Symfony\Component\Filesystem\Exception\FileNotFoundException;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Path;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
...@@ -19,7 +20,7 @@ use ZipArchive; ...@@ -19,7 +20,7 @@ use ZipArchive;
class ProjectController extends AbstractController class ProjectController extends AbstractController
{ {
public function __construct(private TranslatorInterface $translator) public function __construct(private TranslatorInterface $translator, private Filesystem $file_system)
{ {
} }
...@@ -178,6 +179,17 @@ class ProjectController extends AbstractController ...@@ -178,6 +179,17 @@ class ProjectController extends AbstractController
*/ */
private function extractZipArchiveInNewCapsuleDirectory(string $capsule_directory): void private function extractZipArchiveInNewCapsuleDirectory(string $capsule_directory): void
{ {
$prototype_directory_root = '../capsule-prototype';
$this->file_system->mirror(
Path::join($prototype_directory_root),
Path::join($capsule_directory),
null,
['override' => true, 'delete' => true]
);
$this->file_system->copy($prototype_directory_root . '/php', $capsule_directory . '/php', true);
$this->file_system->copy($prototype_directory_root . '/file', $capsule_directory . '/file', true);
$this->file_system->copy($prototype_directory_root . '/file', $capsule_directory . '/file', true);
$zip = new ZipArchive(); $zip = new ZipArchive();
$zip_file_archive_is_open = $zip->open("create.zip"); $zip_file_archive_is_open = $zip->open("create.zip");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment