From f8c24f10516be29eb70463065b8fdb9d50b38e36 Mon Sep 17 00:00:00 2001 From: Damien <damien.burel@maarch.org> Date: Thu, 10 Oct 2019 10:00:32 +0200 Subject: [PATCH] FEAT #11954 TIME 0:30 Migrate extensions --- migration/19.12/migrate.sh | 1 + migration/19.12/migrateExtensions.php | 40 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 migration/19.12/migrateExtensions.php diff --git a/migration/19.12/migrate.sh b/migration/19.12/migrate.sh index e7a4fb0994e..fa43b76da4c 100755 --- a/migration/19.12/migrate.sh +++ b/migration/19.12/migrate.sh @@ -14,3 +14,4 @@ php ./removeProcessModes.php php ./migrateCategories.php php ./migrateOldIndexingModels.php php ./migrateWorkingDays.php +php ./migrateExtensions.php diff --git a/migration/19.12/migrateExtensions.php b/migration/19.12/migrateExtensions.php new file mode 100644 index 00000000000..f88f005b18d --- /dev/null +++ b/migration/19.12/migrateExtensions.php @@ -0,0 +1,40 @@ +<?php + +require '../../vendor/autoload.php'; + +chdir('../..'); + +$migrated = 0; +$customs = scandir('custom'); +foreach ($customs as $custom) { + if ($custom == 'custom.xml' || $custom == '.' || $custom == '..') { + continue; + } + + $xmlfile = null; + $path = "custom/{$custom}/apps/maarch_entreprise/xml/extensions.xml"; + if (file_exists($path)) { + $xmlfile = simplexml_load_file($path); + + if ($xmlfile) { + $i = 0; + foreach ($xmlfile->FORMAT as $item) { + if (isset($item->index_frame_show)) { + $xmlfile->FORMAT[$i]->canConvert = $item->index_frame_show; + unset($xmlfile->FORMAT[$i]->index_frame_show); + } + ++$i; + } + + $res = $xmlfile->asXML(); + $fp = fopen($path, "w+"); + if ($fp) { + fwrite($fp, $res); + } + + $migrated++; + } + } +} + +printf("Migration Extensions : " . $migrated . " custom(s) avec un fichier extensions.xml trouvé(s) et migré(s).\n"); -- GitLab