diff --git a/migration/19.12/migrate.sh b/migration/19.12/migrate.sh index e7a4fb0994e9a7635ffe0fb267fdd6bd2835d33c..fa43b76da4c10667b247099b0b0e65c8f734ca35 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 0000000000000000000000000000000000000000..f88f005b18d4a20ce8d7224f23b1970d519af274 --- /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");