Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Memorekall Member New
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rekall
Memorekall Member New
Commits
e01e6821
Commit
e01e6821
authored
3 years ago
by
Sebastien
Browse files
Options
Downloads
Patches
Plain Diff
rebase on main with annotation mosaic
parent
aa9adbbd
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!84
Tuleap 198 get rid of create zip
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
capsule-prototype/create.zip
+0
-0
0 additions, 0 deletions
capsule-prototype/create.zip
legacy/create.zip
+0
-0
0 additions, 0 deletions
legacy/create.zip
src/Controller/ProjectController.php
+14
-22
14 additions, 22 deletions
src/Controller/ProjectController.php
with
14 additions
and
22 deletions
capsule-prototype/create.zip
deleted
100644 → 0
+
0
−
0
View file @
aa9adbbd
File deleted
This diff is collapsed.
Click to expand it.
legacy/create.zip
deleted
100644 → 0
+
0
−
0
View file @
aa9adbbd
File deleted
This diff is collapsed.
Click to expand it.
src/Controller/ProjectController.php
+
14
−
22
View file @
e01e6821
...
@@ -51,7 +51,7 @@ class ProjectController extends AbstractController
...
@@ -51,7 +51,7 @@ class ProjectController extends AbstractController
return
$this
->
redirectToRoute
(
'capsule_list'
);
return
$this
->
redirectToRoute
(
'capsule_list'
);
}
}
$this
->
extractZipArchiveInNewCapsuleDirectory
(
$capsule_directory
);
$this
->
createDefaultProjectStructure
(
$capsule_directory
);
$this
->
setVideoUrlNodeAttributeInXMLProjectFile
(
$capsule_directory
,
$video_url
);
$this
->
setVideoUrlNodeAttributeInXMLProjectFile
(
$capsule_directory
,
$video_url
);
...
@@ -71,9 +71,6 @@ class ProjectController extends AbstractController
...
@@ -71,9 +71,6 @@ class ProjectController extends AbstractController
}
}
#[Route('/{_locale<%app.supported_locales%>}/project/duplicate', name:'duplicate_project', methods:['POST'])]
#[Route('/{_locale<%app.supported_locales%>}/project/duplicate', name:'duplicate_project', methods:['POST'])]
/**
* @throws ZipArchiveNotOpeningException
*/
public
function
duplicate
(
public
function
duplicate
(
Capsule
$capsule
,
Capsule
$capsule
,
string
$parent_directory
,
string
$parent_directory
,
...
@@ -98,7 +95,7 @@ class ProjectController extends AbstractController
...
@@ -98,7 +95,7 @@ class ProjectController extends AbstractController
return
$this
->
redirectToRoute
(
'capsule_list'
);
return
$this
->
redirectToRoute
(
'capsule_list'
);
}
}
$this
->
extractZipArchiveInNewCapsuleDirectory
(
$capsule_directory
);
$this
->
createDefaultProjectStructure
(
$capsule_directory
);
$this
->
replaceTheWholeFileDirectoryWithParentOne
(
$file_system
,
$parent_directory
,
$capsule_directory
);
$this
->
replaceTheWholeFileDirectoryWithParentOne
(
$file_system
,
$parent_directory
,
$capsule_directory
);
$this
->
createOrUpdatePasswordFile
(
$capsule_directory
,
$capsule
->
getPassword
());
$this
->
createOrUpdatePasswordFile
(
$capsule_directory
,
$capsule
->
getPassword
());
...
@@ -174,10 +171,7 @@ class ProjectController extends AbstractController
...
@@ -174,10 +171,7 @@ class ProjectController extends AbstractController
]);
]);
}
}
/**
private
function
createDefaultProjectStructure
(
string
$capsule_directory
):
void
* @throws ZipArchiveNotOpeningException The archive file doesn't exist.
*/
private
function
extractZipArchiveInNewCapsuleDirectory
(
string
$capsule_directory
):
void
{
{
$prototype_directory_root
=
'../capsule-prototype'
;
$prototype_directory_root
=
'../capsule-prototype'
;
$this
->
file_system
->
mirror
(
$this
->
file_system
->
mirror
(
...
@@ -186,19 +180,17 @@ class ProjectController extends AbstractController
...
@@ -186,19 +180,17 @@ class ProjectController extends AbstractController
null
,
null
,
[
'override'
=>
true
,
'delete'
=>
true
]
[
'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_file_archive_is_open
=
$zip
->
open
(
"create.zip"
);
if
(
!
$zip_file_archive_is_open
)
{
// Remove unnecessary files and directories
throw
new
ZipArchiveNotOpeningException
(
"Create Zip Archive could not be open"
);
$this
->
file_system
->
remove
(
}
[
Path
::
join
(
$capsule_directory
,
'js'
),
$zip
->
extractTo
(
$capsule_directory
);
Path
::
join
(
$capsule_directory
,
'css'
),
$zip
->
close
();
Path
::
join
(
$capsule_directory
,
'webfonts'
),
Path
::
join
(
$capsule_directory
,
'README.md'
),
Path
::
join
(
$capsule_directory
,
'la-page-des-malins.php'
)
]
);
}
}
private
function
setVideoUrlNodeAttributeInXMLProjectFile
(
string
$project_directory
,
string
$video_url
):
void
private
function
setVideoUrlNodeAttributeInXMLProjectFile
(
string
$project_directory
,
string
$video_url
):
void
...
@@ -221,7 +213,7 @@ class ProjectController extends AbstractController
...
@@ -221,7 +213,7 @@ class ProjectController extends AbstractController
private
function
createOrUpdatePasswordFile
(
string
$capsule_directory
,
string
$password
):
void
private
function
createOrUpdatePasswordFile
(
string
$capsule_directory
,
string
$password
):
void
{
{
$project_password_file
=
$capsule_directory
.
"
/file/projectPassword.txt
"
;
$project_password_file
=
$capsule_directory
.
'
/file/projectPassword.txt
'
;
file_put_contents
(
$project_password_file
,
$password
);
file_put_contents
(
$project_password_file
,
$password
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment