Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
82a44e4c
Verified
Commit
82a44e4c
authored
4 years ago
by
Florian Azizian
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #13671 TIME 1:35 migrate img folder
parent
151e6e51
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
migration/20.10/migrate.sh
+1
-0
1 addition, 0 deletions
migration/20.10/migrate.sh
migration/20.10/migrateImages.php
+48
-0
48 additions, 0 deletions
migration/20.10/migrateImages.php
with
49 additions
and
0 deletions
migration/20.10/migrate.sh
+
1
−
0
View file @
82a44e4c
...
...
@@ -3,4 +3,5 @@ php ./migrateConfigXml.php # mettre en premier
php ./migrateNotificationsProperties.php
php ./migrateNotificationsConfig.php
php ./migrateRemoteSignatureBookConfig.php
php ./migrateImages.php
php ./migrateCustomXml.php
# mettre en dernier
This diff is collapsed.
Click to expand it.
migration/20.10/migrateImages.php
0 → 100755
+
48
−
0
View file @
82a44e4c
<?php
require
'../../vendor/autoload.php'
;
chdir
(
'../..'
);
$migrated
=
0
;
$customs
=
scandir
(
'custom'
);
foreach
(
$customs
as
$custom
)
{
if
(
in_array
(
$custom
,
[
'custom.json'
,
'custom.xml'
,
'.'
,
'..'
]))
{
continue
;
}
$oldImgFolderPath
=
"custom/
{
$custom
}
/apps/maarch_entreprise/img"
;
if
(
is_dir
(
$oldImgFolderPath
))
{
if
(
!
is_readable
(
$oldImgFolderPath
)
||
!
is_writable
(
$oldImgFolderPath
))
{
printf
(
"WARNING : The folder %s is not readable or not writable.
\n
"
,
$oldImgFolderPath
);
continue
;
}
$newImgFolderPath
=
"custom/
{
$custom
}
/img"
;
if
(
!
is_dir
(
$newImgFolderPath
))
{
if
(
!@
mkdir
(
$newImgFolderPath
,
0755
,
true
))
{
printf
(
"WARNING : The folder %s can not be created.
\n
"
,
$newImgFolderPath
);
continue
;
}
}
elseif
(
!
is_readable
(
$newImgFolderPath
)
||
!
is_writable
(
$newImgFolderPath
))
{
printf
(
"WARNING : The folder %s is not readable or not writable.
\n
"
,
$newImgFolderPath
);
continue
;
}
$images
=
scandir
(
$oldImgFolderPath
);
foreach
(
$images
as
$image
)
{
if
(
in_array
(
$image
,
[
'.'
,
'..'
]))
{
continue
;
}
if
(
!
rename
(
$oldImgFolderPath
.
'/'
.
$image
,
$newImgFolderPath
.
'/'
.
$image
))
{
printf
(
"WARNING : The file %s can not be moved to
{
$newImgFolderPath
}
: permission denied.
\n
"
,
$image
);
}
}
rmdir
(
$oldImgFolderPath
);
$migrated
++
;
}
}
printf
(
$migrated
.
" dossier(s) custom/custom_id/apps/maarch_entreprise/img trouvé(s) et migré(s).
\n
"
);
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